{"id":4582,"date":"2022-01-20T17:43:05","date_gmt":"2022-01-20T09:43:05","guid":{"rendered":"https:\/\/www.jameseduard.com\/?p=4582"},"modified":"2022-01-20T17:43:05","modified_gmt":"2022-01-20T09:43:05","slug":"how-to-change-azure-subscription-in-powershell","status":"publish","type":"post","link":"https:\/\/www.jameseduard.com\/?p=4582","title":{"rendered":"How to change Azure Subscription in PowerShell"},"content":{"rendered":"\n\n\n<p class=\"wp-block-paragraph\">In this article I&#8217;ll guide you how to change the azure subscription using PowerShell, we can use the&nbsp;command <strong>Select-AZSubscription<\/strong>&nbsp;and this Changes the current and default Azure subscriptions. When you use this command, you can use either the subscription ID, Subscription Name, or the Tenant ID.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>You can query with the <strong>Subscription Name<\/strong><\/li><\/ol>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">Select-AzSubscription -SubscriptionName 'James Eduard Lab'<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2.  or you can query with <strong>With TenantID<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">Select-AzSubscription -Tenant 'XXXX-XXXXX-XXXXXXX-XXXX'<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. With Subscription ID<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">Select-AzSubscription -SubscriptionId 'XXXX-XXXXX-XXXXXXX-XXXX'<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It takes some time to display the result on console it will display one or more subscriptions. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In that case, you can switch to the other subscription using these commands&nbsp;<strong>Set-AZContext&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sets the tenant, subscription, and environment for cmdlets to use in the current session. Command and you can use subscription ID or Name for it.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">Query via Subscription ID: <\/pre>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">Set-AzContext -SubscriptionId \"xxxx-xxxx-xxxx-xxxx\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Query via Subscription Name:<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">Set-AzContext -SubscriptionName \"James Eduard Lab\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article I&#8217;ll guide you how to change the azure subscription using PowerShell, we can use the&nbsp;command Select-AZSubscription&nbsp;and this Changes the current and default Azure subscriptions. When you use this command, you can use either the subscription ID, Subscription Name, or the Tenant ID. You can query with the Subscription Name 2. or you<\/p>\n","protected":false},"author":1,"featured_media":4583,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[99,52,47],"tags":[856,93,857,102,858],"class_list":["post-4582","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-devops","category-how-tos","tag-az-powershell","tag-azure","tag-azurecli","tag-powershell","tag-software-coding"],"_links":{"self":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/posts\/4582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4582"}],"version-history":[{"count":0,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/posts\/4582\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}