How to Fix SubscriptionNotFound (Azure Subscriptions)
Quick Answer
The 'SubscriptionNotFound' error indicates that the Azure subscription ID provided or implicitly used does not exist or is inaccessible within the current context. The fastest fix often involves verifying the subscription ID and ensuring the correct Azure account and directory are selected.
What Causes This Error
- Incorrect or mistyped Azure subscription ID.
- The user account does not have access to the specified subscription.
- The subscription has been deleted, disabled, or moved.
- The user is logged into the wrong Azure Active Directory (tenant).
- Azure CLI or PowerShell context is set to an incorrect subscription or tenant.
- Service Principal or Managed Identity lacks permissions to the subscription.
Step-by-Step Fixes
1Verify Azure Subscription ID and Account Context
- Sign in to the Azure portal (portal.azure.com) with the account expected to have access to the subscription.
- In the Azure portal, navigate to 'Subscriptions' by typing 'Subscriptions' into the global search bar and selecting it from the results.
- Review the list of subscriptions displayed. Confirm that the subscription ID you are attempting to use is present and active in this list.
- If the subscription is not listed, ensure you are in the correct Azure Active Directory (tenant). Use the 'Directory + subscription' filter icon near the top right of the portal to switch directories if necessary.
- Compare the subscription ID from the portal with the ID used in your command, script, or application configuration. Correct any discrepancies.
2Check User Permissions for the Subscription
- Log in to the Azure portal (portal.azure.com) using an account that has 'Owner' or 'User Access Administrator' permissions on the subscription in question.
- Navigate to 'Subscriptions' and select the specific subscription that is generating the 'SubscriptionNotFound' error for other users.
- From the subscription's overview page, select 'Access control (IAM)' from the left-hand menu.
- Click on 'Check access' and then 'View my access' or 'View access for a user' to determine the roles assigned to the user experiencing the error.
- If the user lacks appropriate permissions (e.g., Reader, Contributor, Owner) to the subscription, assign the necessary role to grant access. This may resolve the 'SubscriptionNotFound' error by making the subscription visible and accessible to the user.
3Set Correct Azure CLI/PowerShell Context to Resolve SubscriptionNotFound
- Open your Azure CLI or Azure PowerShell environment.
- For Azure CLI, run 'az login' to authenticate. For Azure PowerShell, run 'Connect-AzAccount'. Ensure you log in with the correct credentials associated with the desired subscription.
- After logging in, verify the current subscription context. For Azure CLI, run 'az account show'. For Azure PowerShell, run 'Get-AzContext'.
- If the displayed subscription ID is incorrect, set the context to the correct subscription. For Azure CLI, use 'az account set --subscription "<Subscription ID or Name>"'. For Azure PowerShell, use 'Set-AzContext -Subscription "<Subscription ID or Name>"'.
- Re-run your original command or script that was encountering the 'SubscriptionNotFound' error. The command should now execute against the correctly specified subscription.
4Verify Subscription Status and Reactivate if Disabled
- Sign in to the Azure portal (portal.azure.com) with an account that has 'Owner' permissions across your organization's Azure Active Directory.
- Navigate to 'Subscriptions' and locate the subscription ID that is causing the error.
- Check the 'Status' column for the subscription. If the status is 'Disabled', 'Expired', or 'Suspended', this is the reason for the 'SubscriptionNotFound' error.
- If the subscription is disabled, click on the subscription and look for options to reactivate it. This process typically involves contacting Azure Support or addressing billing issues.
- Follow the prompts to reactivate the subscription. Once reactivated, wait a few minutes for the changes to propagate, then re-attempt your operation.
Frequently Asked Questions
What does 'SubscriptionNotFound' mean in Azure?
The 'SubscriptionNotFound' error indicates that Azure cannot locate a subscription with the specified ID for the current user or service principal within the active Azure Active Directory tenant. This usually means the ID is wrong, the subscription doesn't exist, or the user lacks access.
Can a deleted subscription cause this error?
Yes, if a subscription has been deleted, any attempt to reference its ID will result in a 'SubscriptionNotFound' error because the resource no longer exists within Azure's records. Verification in the Azure portal is recommended.
How do I find my Azure subscription ID?
You can find your Azure subscription ID by logging into the Azure portal (portal.azure.com), typing 'Subscriptions' into the global search bar, and selecting 'Subscriptions'. Your subscription IDs will be listed there.
Why would my Azure CLI or PowerShell show 'SubscriptionNotFound'?
This typically happens if your Azure CLI or PowerShell context is not set to the correct subscription or Azure Active Directory tenant. You need to ensure you are logged in with the right account and have explicitly set the context to the intended subscription using 'az account set' or 'Set-AzContext'.
Does this error relate to network connectivity?
No, the 'SubscriptionNotFound' error is not directly related to network connectivity issues. It is an authorization or identification error, indicating that the Azure service cannot find or access the specified subscription based on the provided credentials and context.