【发布时间】:2019-11-20 10:56:40
【问题描述】:
我正在尝试访问 Microsoft Graph API 以获取 Azure 安全中心的 secureScore,但我无法找到为我提供此信息的端点。 我可以通过https://graph.microsoft.com/beta/security/secureScores 轻松找到 Office 365 的secureScore,但这并没有为我提供 Azure 的。
我正在使用应用注册对 Graph 进行身份验证。 这是用于获取 Office 365 的 secureScore 的代码:
#Assign the Client/Application ID, Client Secret and Tenant Domain
$ClientID = 'CLIENTID'
$ClientSecret = 'CLIENTSECRET'
$tenantdomain = 'TENANTNAME.onmicrosoft.com'
$loginURL = "https://login.microsoft.com"
$resource = "https://graph.microsoft.com"
$body = @{grant_type="client_credentials";resource=$resource;client_id=$ClientID;client_secret=$ClientSecret}
$oauth = Invoke-RestMethod -Method Post -Uri $loginURL/$tenantdomain/oauth2/token?api-version=1.0 -Body $body
$headerParams = @{'Authorization'="$($oauth.token_type) $($oauth.access_token)"}
[uri]$uriGraphEndpoint = "https://graph.microsoft.com/beta/security/secureScores"
$response = Invoke-RestMethod -Method Get -Uri $uriGraphEndpoint.AbsoluteUri -Headers $headerParams
谁能指出我正确的方向?
【问题讨论】:
标签: microsoft-graph-api azure-ad-graph-api