Trouble Assigning Cosmos DB Operator Role to User-Assigned Managed Identity via ARM Template

Djordje Djukic (AKVELON INC) 0 Reputation points Microsoft Vendor
2024-06-06T11:45:22.9333333+00:00

Hi Azure Community,

I'm currently working on assigning the Cosmos DB Operator role to a user-assigned managed identity using an ARM template. Despite following the documentation, I'm encountering a "not found" error, and I'm not sure what I'm doing wrong.

Thanks in advance.

{
      "type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments",
      "apiVersion": "2021-05-15",
      "name": "[concat(variables('cosmosDbAccountName'), '/', guid('roleAssignment1', 'data'))]",,
      "dependsOn": [
        "[concat('Microsoft.DocumentDB/databaseAccounts/', variables('cosmosDbAccountName'))]",
        "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('identityName'))]"
      ],
      "properties": {
        "roleDefinitionId": "[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', variables('cosmosDbAccountName'), '230815da-be43-4aae-9cb4-875f7bd000aa')]",
        "principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('identityName'))).PrincipalId]",
        "scope": "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('cosmosDbAccountName'))]"
      }
 }

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,520 questions
{count} votes