Skip to content
adatum
  •  SCOM Web API
  • About adatum
Azure

Multiple Azure credentials in PowerShell

  • 06/05/202002/09/2020
  • by Martin Ehrnst

Environments in Azure are often separated into multiple subscriptions, in some cases multiple tenants. This sectioning can also result in multiple user accounts, and managing multiple Azure credentials can be challenging. Luckily, Azure PowerShell has this capability called context.

Although the documentation is solid on the topic. It doesn’t necessarily provide the backdrop for when you will need to use this feature.

A few weeks ago I had to move a set of APIs from one instance of Azure API management to another. With PowerShell contexts, I could download the API from the origin and import it to the new instance.

Connecting to multiple Azure environments using context

To hold credential information, like user and subscription. PowerShell uses context objects. By using AzContext comandlets You can have multiple Powershell Azure contexts available in the same PowerShell session. This allows for easy switching between multiple environments and profiles. Including different tenants.

Below is an example of how you can connect to multiple tenants and switch between the credentials and contexts. I recommend using friendly names which will make them easier to identify.

Azure PowerShell context

Share this:

  • LinkedIn
  • Twitter

Related

Jumpstart your Azure Monitor journey
IT Pro announcements from Microsoft Build
Azure Powershell

Related articles

gray laptop computer showing html codes in shallow focus photography
Azure Infrastructure As Code video…
flight sky earth space
Recording available: ARM template deployment…
Recording available: Complex ARM templates
Remediate Azure Policy with PowerShell
Jumpstart your Azure Monitor journey
2 COMMENTS
  • PowerShell SnippetRace 19-2020 | | PowerShell Usergroup Austria
    10/05/2020 at 18:55
    Reply

    […] If you have to deal with multiple Azure credentials, its sometimes time-consuming to switch between those. Martin Ehrnst wrote some code to explain Azure context. Link […]

  • ICYMI: PowerShell Week of 08-May-2020 – 247 TECH
    09/05/2020 at 00:36
    Reply

    […] Multiple Azure credentials in PowerShell […]

Engage by commenting Cancel reply

Top Posts & Pages

  • Azure AD authentication in Azure Functions
  • Judging Arctic Cloud Developer Challenge
  • Creating Azure AD Application using Powershell
  • Web API for System Center Operations Manager
  • Multi subscription deployment with DevOps and Azure Lighthouse
  • Access to Blob storage using Managed Identity in Logic Apps - by Nadeem Ahamed
  • Using Azure pipelines to deploy ARM templates
  • Update: SCOM web API
  • Script to add SCOM agent management group
  • Resource health through Azure Rest API

Tags

agent announcements api ARM authoring Automation Azure AzureAD AzureCloudShell AzureFunctions AzureLighthouse AzureMonitor AzureSpringClean Bicep Community CSP database EventGrid ExpertsLive ExpertsLiveEU IaC Infrastructure as code Integrations LogAnalytics management pack monitoring MSIgnite MSIgnite2017 MSOMS MSP nicconf OperationsManager OpsMgr Powershell QUickPublish rest SCDPM SCOM SCOM2016 SCVMM Serverless SquaredUP SysCtr system center Webasto

Follow Martin Ehrnst

  • Twitter
  • LinkedIn

RSS Feed RSS - Posts

RSS Feed RSS - Comments

Microsoft Azure MVP

Martin Ehrnst Microsoft Azure MVP

NiCE Active 365 Monitor for Azure

NiCE active 365 monitor for Azure
Adatum.no use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Cookie Policy
Theme by Colorlib Powered by WordPress