I'm building a CLI app for provisioning Azure resources. Previously I was using the authorization code flow with the resource
set to https://management.azure.com/
. Now, I would like to switch to using the RFC 8628 device authorization grant type (Azure documentation). I can successfully login with scopes like openid profile
. However, when I use a scope like https://management.azure.com
I get an error:
{
"error": "invalid_scope",
"error_description": "AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter 'scope' is not valid. The scope openid https://management.azure.com/ is not valid. The scope format is invalid. Scope must be in a valid URI form <https://example/scope> or a valid Guid <guid/scope>.\r\n[..]",
"error_codes": [70011],
}
I'm sending a POST request with a body like client_id=<client-id>&scope=openid+https%3A%2F%2Fgraph.microsoft.com%2F.default
to https://login.microsoftonline.com/<tenant>/oauth2/v2.0/devicecode
. With these scopes, I can login just fine, but any subsequent requests to Azure resource management APIs (for example, to DELETE
a resource group) will fail with 401 Unauthorized
.
41094075-9dad-400e-a0bd-54e686782033
as scope id? – Gaurav Mantrihttps://management.azure.com/.default
. – Gaurav Mantrihttps://management.azure.com/.default
already, that also didn't work. – djc41094075-9dad-400e-a0bd-54e686782033
and it failed in a different way: "AADSTS65002: Consent between first party applications and resources must be configured via preauthorization. Visit identitydocs.azurewebsites.net/static/aad/preauthorization.html for details". Unfortunately I cannot open that documentation URL ("Selected user account does not exist in tenant 'Microsoft' and cannot access the application 'ad9c3e97-0ae9-4928-a97d-63a69f873726' in that tenant."). – djc