标签:操作 ant 授权 type reg hat you OLE sed
Azure Active Directory (Azure AD) is Microsoft’s cloud-based identity and access management service, which helps your employees sign in and access resources in Azure.
当我们使用REST API调用Azure上任何资源的时候,都需要在Request Header中提供Authorization的值。
如何获取Authorizatoin的值呢?
以下内容则主要介绍如何通过AAD API获取Token(常规的操作方式)。
1,获取
3,获取
在应用的概述(Overview)页面中复制出租户(tenant),客户端()。见上图中的三组GUID数字。
4,获取客户端密码[client_secret]
scope: |
https://microsoftgraph.chinacloudapi.cn/.default |
grant_type: | client_credentials |
使用Postman调用Token终结点,全部的参数为:
请求方式 | POST |
请求URL | https://login.chinacloudapi.cn/{TENANT}/oauth2/v2.0/token |
请求Body | |
tenant:{TENANT} |
|
请求成功后的响应Body |
|
{
"token_type": "Bearer",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1QiLCJub25jZSI6IjFJRk1tbFNMcnV1 ... ... ... ... W0Da3_LzLhdNA"
}
|
Postman截图说明:
获取到access_token的值后,即可作为Auzre REST API接口中Authroization的值。
访问https://jwt.io/,可以解码Token内容,查看当前Token中所携带的权限(Role). 演示操作:
什么是 Azure Active Directory?https://docs.azure.cn/zh-cn/active-directory/fundamentals/active-directory-whatis
Microsoft Graph REST API v1.0 reference: https://docs.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0
附录一:通过F12(开发者工具)中查看Network中Request的Header中的Authorization值
【Azure Developer】使用Postman获取Azure AD中注册应用程序的授权Token,及为Azure REST API设置Authorization
标签:操作 ant 授权 type reg hat you OLE sed
原文地址:https://www.cnblogs.com/lulight/p/14279338.html