I have currently problems with the token for the MS Dev Center service.
I call the REST API PUT {endpoint}/projects/{projectName}/users/{userId}/devboxes/{devBoxName}?api-version=2023-04-01
with a Bearer token like described:
AAD Token
- I have the right authority.
- I have the right scope "user_impersonation"
- I use the implicit oauth2 flow
I successfully retrieved the token with the CLI:
az account get-access-token --resource https://devcenter.azure.com
but when I use the interactive flow in my react app, I get a 401.
Observations:
-
The jwt token retrieved with the CLI is encrypted
-
The browser "Try it" function under (https://learn.microsoft.com/de-de/rest/api/devcenter/developer/dev-boxes/create-dev-box?view=rest-devcenter-developer-2023-04-01) is also not working, when I log in with the account which should be able to create a dev box. (401)
Any ideas?
2
Answers
In the Microsoft documentation it says you need to use the user_impersonation scope.
I solved it by configuring the "Fidalgo Dataplane Public" API with "access_as_user" scope in my app registration.
Fidalgo Dataplane Public
It wasn’t exactly clear in your post but ensure you have the Dev Box User Role on the project with a Dev Box Pool.