Search code examples
azure-resource-managerazure-rest-apiazure-blueprints

Authentication via managed identity for blueprint assignment


I have to assign a blueprint via Rest API (link)

How can I get token with managed identity? Managed Identity is like below:

{
  "id": "/subscriptions/xxx-xxx-xxx/resourcegroups/xxxx/providers/Microsoft.ManagedIdentity/userAssignedIdentities/xxx",
 "name": "xxx",
 "type": "Microsoft.ManagedIdentity/userAssignedIdentities",
 "location": "westeurope",
 "tags": {},
 "properties": {
     "tenantId": "xxx",
     "principalId": "xxx",
     "clientId": "xxx"
 }
}

The enterprise app that created with managed identity hasn't any client secret. How can I get token for assign the the blueprint via api?

Any advice would be appreciated.


Solution

  • You can't but you also don't need to - to create the BP Assignment you need the token of a user/principal that has permissions to create assignments at that scope.

    The resources created during assignment will use the MSIs context and that's handled by the Blueprint itself.

    That help?