Hi @Nishant Gupta,
Thanks for the question and using MS Q&A platform.
The error you’re encountering typically indicates that the role definition is missing or incorrectly specifying the assignableScopes
. Below are a few common causes and solutions:
Missing or Incorrect Role Definition API Version
When creating custom roles via Azure, the API version you are using must support role definitions at the Cosmos DB container level. The apiVersion
must be set to a version that supports creating and assigning roles at the resource and container levels.
"apiVersion": "2020-04-01-preview"
This API version supports role definitions for Cosmos DB resources at various levels, including the container.
Check Permissions for Container-Level Access: Make sure that the permissions you’re specifying in the custom role are valid for the level of granularity you're targeting. In your case, you’re trying to define a role with both read and write permissions at the container level. Ensure these permissions are supported by the API and correctly applied at the container scope.
Use the correct role definition type (Microsoft.Authorization/roleDefinitions
)
Once you ensure all of this, the error should resolve, and the custom role will be created and assigned properly at the container level.
Hope this helps. Do let us know if you any further queries. If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.