Urgent Issue with Role Assignment in Azure – "MissingSubscription" Error

nehad shmale 0 Reputation points
2025-03-03T20:04:06.93+00:00

 

Issue: Unable to Assign Role to ACR - MissingSubscription Error

Problem Description:

I encountered an issue while trying to assign the AcrPull role to a service principal for my Azure Container Registry (ACR). Every time I run the following command:

az role assignment create \

  --assignee

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
493 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pradeep Kommaraju 545 Reputation points Microsoft Employee
    2025-03-04T07:47:09.85+00:00

    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:

    1. Ensure You're Logged In:

    Run:

    
    az login
    
    
    1. Set the Correct Subscription:
    
    az account set --subscription <subscription-id>
    
    
    1. Verify the Subscription:
    
    az account show --output table
    
    
    1. 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>
    
    
    1. 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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.