unable to connect Azure

Glenn Maxwell 11,316 Reputation points
2024-09-19T15:36:47.1233333+00:00

Hi All

I use the below syntax to connect to Azure Powershell, but today i am unable to connect to azure powershell. it prompts me to enter tenant and subscription number. I have 1500 subscriptions, how can i know the subscription number for my subscription id. please guide me.


Connect-AzAccount -Credential (get-credential -UserName user1@contoso.com)
Select a tenant and subscription: 12121212-1212-1212-1212-1212121212 

Connect-AzAccount : Typed subscription is not a number.


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,520 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,499 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,653 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vasileios Dionysopoulos 641 Reputation points
    2024-09-19T20:07:13.2966667+00:00

    Hello,

    First connect without specifying a subscription then list all subscriptions:

    Connect-AzAccount
    Get-AzSubscription | Select-Object SubscriptionName, SubscriptionId
    

    Once you've identified the correct subscription ID or name from the list, you can switch to that subscription using the Set-AzContext command

    Set-AzContext -SubscriptionId "12121212-1212-1212-1212-1212121212"
    

    if you know part of the subscription you can also use the following:

    Get-AzSubscription | Where-Object { $_.SubscriptionName -like "*YourSubscriptionName*" } | Select-Object SubscriptionName, SubscriptionId
    

    I hope i help,

    Vasilis

    0 comments No comments

  2. Raja Pothuraju 6,170 Reputation points Microsoft Vendor
    2024-09-23T22:22:02.86+00:00

    Hello @Glenn Maxwell,

    Thank you for posting your query on Microsoft Q&A.

    Based on your description, it seems that whenever you try to run Connect-AzAccount, you are prompted with "Select a tenant and subscription (type a number or Enter to accept default):". You mentioned entering the Subscription ID as "12121212-1212-1212-1212-1212121212". However, you need to enter the corresponding number of the subscription from the output list. Please refer to the screenshot below to see how to find the value number for your subscription.User's image

    I hope this information is helpful. Please feel free to reach out if you have any further questions.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Thanks,
    Raja Pothuraju.


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.