Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Set an Azure Subscription for Default Login in PowerShell

May 19, 2024
in Blog, Microsoft Azure, Powershell
0
ADVERTISEMENT

Table of Contents

Name                              Id                      TenantId                     State  
----                              --                      --------                     -----  
Azure Active Directory            10376480-f866-4c43-bbe3 615dc844-35d3-40c2-9db4-xxxx Enabled
Azure Active Directory            94aacba4-9afb-4c3e-9e7b 615dc844-35d3-40c2-9db4-xxxx Enabled
AD04                              c4909c7e-5dc3-43c7-9911 615dc844-35d3-40c2-9db4-xxxx Enabled
RB.60-66                          3177f05d-9d74-4995-abf8 615dc844-35d3-40c2-9db4-xxxx Enabled
RB.05.08                          b319d331-f43b-4347-903d 615dc844-35d3-40c2-9db4-xxxx Enabled
RB.09.12                          633c1a7c-95b3-4b76-a18b 615dc844-35d3-40c2-9db4-xxxx Enabled
RB.37.42                          ea90ff0f-913a-4b6e-809c 615dc844-35d3-40c2-9db4-xxxx Enabled
RB.70.76                          7a09c8e3-6737-4846-9eb5 615dc844-35d3-40c2-9db4-xxxx Enabled

In some cases, your Azure tenant has multiple Azure subscriptions. Every time, when you sign-in into Microsoft Azure using PowerShell, you would get this warning:

WARNING: TenantId ‘615dc844-35d3-40c2-9db4-0439991ec82e’ contains more than one active subscription. First one will be selected for further use. To select another subscription, use Set-AzContext. To override which subscription Connect-AzAccount selects by default, use `Update-AzConfig -DefaultSubscriptionForLogin 00000000-0000-0000-0000-000000000000`. Go to https://go.microsoft.com/fwlink/?linkid=2200610 for more information.

Set your Azure default Subscription

You want to set a subscription by default every time you sin-in into Azure using PowerShell.

1. Login into Microsoft Azure using PowerShell using Connect-AzAccount command.

Connect-AzAccount

2. Get the list of the subscriptions in your tenant by name and id. Write down the subscription name or id of the one you want to set to be default subscription.

Get-AzSubscription | Select Name, Id
Name                                        Id
----                                        --
Access to Azure Active Directory            10376480-f866-4c43-bbe3-3cdeb8ebf6b5
Access to Azure Active Directory            11e4abe9-6f88-4d18-97a0-8bf115fb0796
Access to Azure Active Directory            931dc0f7-2125-469a-9830-8ba63bcf6aff
AD09                                        36a4f20e-110e-44f9-ac0e-67d43bc691a7
RB.110.116                                  9511a764-5f67-4619-82b8-48f1e9190e39
RB.31.36                                    5f0a10be-14e3-4720-af5d-bd09c8b0ae65
RB.90.96                                    3c78f1a9-f55d-4c28-8331-f9d99258ed02

3. Run the following command to set a subscription to the default on when login.

Update-AzConfig -DefaultSubscriptionForLogin "Name of subscription or Subcription Id"
Key                         Value                                Applies To Scope       
---                         -----                                ---------- -----       
DefaultSubscriptionForLogin bbf658dc-xxxx-4f6a-b2bc-7c379632c9b7 Az         CurrentUser 

4. Disconnect from Azure PowerShell the reconnect to verify it works.

PS C:\> Disconnect-AzAccount
PS C:\> Connect-AzAccount

Account            SubscriptionName TenantId                             Environment
-------            ---------------- --------                             -----------
[email protected] AD09             36a4f20e-110e-xxxx-ac0e-67d43bc691a7 AzureCloud
ADVERTISEMENT

Not a reader? Watch this related video tutorial:

5/5 - (1 vote)
Previous Post

How to Create phpinfo File and Check PHP Information

Next Post

How to Install VMware Tools on CentOS 9 Virtual Machine

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory