无法在Postman中身份验证Azure AD功能应用程序
我已启用了函数应用程序的Azure AD。 AzureIdentity是我的功能应用程序名称。 我正在使用“ \ oauth2 \ token”
Get:
https://login.microsoftonline.com/{my tenant ID}/oauth2/token
Headers: Content-Type: application/x-www-form-urlencoded
Body:
grant_type:client_credentials
resource:https://management.azure.com/
client_id:04e17699-64cd-42ec-96ec-23be345ef6ed
client_secret:{My secret}
我在get request上获得了携带者令牌并将其传递给功能,但是我遇到了401个身份验证错误,如下所示。不知道我在哪里做错了。
请帮助我如何验证该功能,谢谢。
I have enabled Azure AD for the function APP. AzureIdentity is my Function APP name.
I am using "\oauth2\token"
Get:
https://login.microsoftonline.com/{my tenant ID}/oauth2/token
Headers: Content-Type: application/x-www-form-urlencoded
Body:
grant_type:client_credentials
resource:https://management.azure.com/
client_id:04e17699-64cd-42ec-96ec-23be345ef6ed
client_secret:{My secret}
I am getting bearer token on Get request and passing it to the Function, but I am getting 401 Authentication error as below. Not sure where I am doing wrong.
Please help how can I authenticate the function, Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不需要“资源”参数,而是使用“范围”参数
范围,这是我的自定义应用ID,其定义了自定义应用程序角色。
范围==> “ 04E17699-64CD-42EC-96EC-23BE345EF6ED/.DEFAULT”
'resource' parameter is not required, instead use 'scope' parameter
Scope here is my custom app ID which has a custom application role defined.
scope ==> "04e17699-64cd-42ec-96ec-23be345ef6ed/.default"
我试图在环境中重现相同的错误,并获得了与以下相同的错误:
要解决错误,请使用
v2 endpoint
来生成以下令牌:使用上述生成的访问令牌,我能够成功地调用函数应用程序,如下所示:
确保给出 code 您在功能url中作为
x-function-key
参数。I tried to reproduce the same in my environment and got the same error as below:
To resolve the error, make use of
V2 endpoint
to generate the token like below:Using the above generated access token, I am able to call the Function app successfully like below:
Make sure to give the code you get in function URL as a value to
x-function-key
parameter.