question

shaileshpathak-6177 avatar image
0 Votes"
shaileshpathak-6177 asked amkamath commented

Azure CLI - Service Principal login - isn't working for me

it throws error --

No subscriptions found for <SUBSCRIPTION-ID>

azure-ad-connect
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

amanpreetsingh-msft avatar image
0 Votes"
amanpreetsingh-msft answered AndersSwanson-4347 commented

@shaileshpathak-6177 In order to enable Azure CLI, you need to have an active subscription as it creates a storage account for this purpose. If there is no active subscription avialable, this is expected.


Please "Accept as answer" wherever the information provided helps you to help others in the community.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

what is meant by "active subscription"? do you have link to a docs? I'm not willing to accept your suggestion below to "use PowerShell"...

0 Votes 0 ·
showkatmir avatar image
0 Votes"
showkatmir answered shaileshpathak-6177 commented

Hi shaileshpathak-6177, what are you trying to achieve, Could you pleaser throw some more light.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

All I want to login to my account through command prompt and found the query how to do it and the process. which is through service principal. But when I hit the command I get the error No Subscription found.

0 Votes 0 ·
shaileshpathak-6177 avatar image
0 Votes"
shaileshpathak-6177 answered

Any update?>

All I want to login to my account through command prompt and found the query how to do it and the process. which is through service principal. But when I hit the command I get the error No Subscription found.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

amanpreetsingh-msft avatar image
1 Vote"
amanpreetsingh-msft answered

@shaileshpathak-6177 You can use PowerShell for this purpose which doesn't require a subscription. Refer to the stpes here:
https://docs.microsoft.com/en-us/powershell/azure/active-directory/signing-in-service-principal?view=azureadps-2.0

If you are getting below error while trying to connect to Azure CLI via portal and you don't have a subscription this is expected and there is no workaround for this. There must be a subscription avialable.

7534-capture.jpg

As I mentioned earlier, cloud shell requires a storage account to be created in the subscription. If you don't have a subscription, you cannot deploy storage account and use Azure CLI. Below is the resource group and storage account created for Azure CLI in my case:

7503-untitled.png


Please "Accept as answer" wherever the information provided helps you to help others in the community.


capture.jpg (20.2 KiB)
untitled.png (11.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

CoryShike avatar image
4 Votes"
CoryShike answered amkamath commented

Use the --allow-no-subscriptions switch to get past the error and log in this is what I needed to do to connect to DevOps to create repos etc.

 az login --allow-no-subscriptions
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks, this worked for me when trying to use SP with no subscription assigned via az cli

0 Votes 0 ·