Hello
Thanks for reaching out to Microsoft Q and A Forum ,
The MissingSubscription error typically occurs when the Azure CLI cannot determine the active subscription. Try the following steps to resolve it:
- Ensure You're Logged In:
Run:
az login
- Set the Correct Subscription:
az account set --subscription <subscription-id>
- Verify the Subscription:
az account show --output table
- Check Role Assignment Scope:
Ensure the correct scope is used:
az role assignment create --assignee <assignee> --role AcrPull --scope /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ContainerRegistry/registries/<registry-name>
- Verify Service Principal Permissions:
Ensure the service principal has the right permissions to assign roles.
If the issue persists, try running the command with --debug
to check detailed logs or consider re-authenticating with az login --identity
if using a managed identity.
If your issue is resolved please do accept this answer . Also don't hesitate to ask if you have any further questions
Thanks,
Pradeep