Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • VirtualBox
  • VMware
  • Windows
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
  • More
    • Office Deployment Tool
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • VirtualBox
  • VMware
  • Windows
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
  • More
    • Office Deployment Tool
    • 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

December 23, 2022
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.

PS C:\> 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"
PS C:\> "Update-AzConfig -DefaultSubscriptionForLogin bbf658dc-12dd-4f6a-b2bc-7c379632c9b7"

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
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

Ftr29

How to Fix Your Windows 7 System is Too Outdated Roblox Kb4534310 Error

May 26, 2023
Ftr5

How to Use Robocopy to Increase Copy Speed in Windows

May 17, 2023
Ftr32

How to Track Emails Though the Logs in MDaemon Email Server

May 16, 2023
cyberpanel

How to Disable IP Check on CyberPanel

May 14, 2023
cyberpanel

Disk Usage or Bandwidth Usage Show 0MB in CyberPanel

May 9, 2023
cyberpanel

How to Install CyberPanel on Ubuntu 22.04

May 5, 2023

Leave a Reply Cancel reply

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

Recent Posts

  • How to Fix Your Windows 7 System is Too Outdated Roblox Kb4534310 Error
  • How to Use Robocopy to Increase Copy Speed in Windows
  • How to Track Emails Though the Logs in MDaemon Email Server

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

Socials

Twitter

Telegram

YouTube

Discord

Copyright 2023 © 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