No subscriptions were found for 'None'. If this is expected, use '--allow-no-subscriptions' to have tenant level access

john john 946 Reputation points
2021-05-01T22:50:01.327+00:00

I want to login to azure to run these commands on a web app:-

 az login  
 az account set --subscription "Pay-As-You-Go"  
 az webapp identity assign --name "****" --resource-group "****"  
 az keyvault set-policy --name "****" --object-id "***" --secret-permissions get list   
  

where we are managing our customers' azure through the Microsoft Partner Center, as follow:-

93067-customer-2.png

when I click on a Customer >> then click on "view all resources on Azure portal" >> then when I click on "View My Access" i will get this :-

93069-cusotmer-3.png

But when I try to login to azure using this Powershell command:-

C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9>az login   

using the same username i login to the UI, I will get this error:-

You have logged in. Now let us find all the subscriptions to which you have access... No subscriptions were found for 'None'. If this is expected, use '--allow-no-subscriptions' to have tenant level access

so I am confused because using the UI I can access the customer + create web apps for the customer.. so why when I login to azure using PowerShell I got the above error that i do not have subscription?

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,562 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Saurabh Sharma 23,751 Reputation points Microsoft Employee
    2021-05-03T23:35:16.007+00:00

    Hi @john john ,

    Thanks for using Microsoft Q&A !!
    Please use the Get-AzContext to get the metadata (like AD Account, Tenant, Subscription) used to authenticate in PowerShell. If you do not see the correct tenant details, then use Remove-AzContext to remove the existing context. Then you can try running the above commands.

    If you have any other cloud environments like Govt. Cloud? Please use az cloud list to get the list of cloud environments you have. Please use az cloud set -n AzureCloud to set to public one and then execute other commands.

    Please let me know if you still have any issues or any questions.

    Thanks
    Saurabh