question

IngridHenkel-7248 avatar image
0 Votes"
IngridHenkel-7248 asked JamesTran-MSFT commented

Azure Managed Identity with Azure Media Services

I am writing Python code that is attempting to use a user managed identity. The id is correctly formatted (I think) but I keep getting the same error no matter what I do to the string.

This is the error:

 Code: LinkedInvalidPropertyId
 Message: Property id 'AZURE_MANAGED_IDENTITY_ID' at path '' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.

The line for creating the id looks like this:

 managed_identity_resource = f"/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{MANAGED_IDENTITY_NAME}"


Where the variables are loaded from a .env file. The variables are loading properly so that's not the problem.

The string that is created is perfect. So I don't understand why I am getting this error.

Thanks

azure-managed-identity
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JamesTran-MSFT avatar image
0 Votes"
JamesTran-MSFT answered JamesTran-MSFT commented

@ngridHenkel-7248
Thank you for your post and I apologize for the delayed response!

When it comes to your error message, have you tried using the full PUT request?
Can you share any documentation that you're following so I can gain a better understanding of your issue?


From our User Assigned Identities - Create Or Update documentation, can you see if using the full request helps resolve your issue, for more info.

 Request:
 PUT https://management.azure.com/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/resourceName?api-version=2018-11-30
    
 Request Body:
 {
   "location": "eastus",
   "tags": {
     "key1": "value1",
     "key2": "value2"
   }
 }
    
 Sample Response:
 {
   "id": "/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
   "location": "eastus",
   "name": "identityName",
   "properties": {
     "clientId": "clientGUID",
     "principalId": "identityObjectID",
     "tenantId": "tenantGUID"
   },
   "tags": {
     "key1": "value1",
     "key2": "value2"
   },
   "type": "Microsoft.ManagedIdentity/userAssignedIdentities"
 }


If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi James,
The problem was with the way I was putting the managed identity into the request. I had managed_identity_resource in quotes. The below is the correct way.

 identity = MediaServiceIdentity(
     type = "UserAssigned",
     user_assigned_identities = {
       managed_identity_resource : {}
     }
   ),

Ingrid

0 Votes 0 ·

@IngridHenkel-7248
Thank you so much for the quick follow up on this and I'm glad that you were able to resolve your issue!


If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.


Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.
Note: Microsoft Q&A has a policy that "The question author cannot accept their own answer. They can only accept answers by others."

0 Votes 0 ·