Skip to content

0.6.1 Get-AzSubscription #7954

Closed
Closed
@ronbok

Description

@ronbok

Description

VS Code w/Get-AzSubscription.

Script/Steps for Reproduction

Start VS Code with PowerShell Core 6.1.0 in terminal. Using the VS Code 1.29.1 w/Azure Account 0.6.2 extension one could simply type Get-AzureRmSubscription and you were signed in using Windows PowerShell 5.1 w/AzureRm (any version).

NOT with Az. Instead you get WARNING: Unable to acquire token for tenant '6c648512-a417-....'

Additionally, when you attempt to save your context with Save-AzContext and reload it on your next session, it loads your saved context, but doesn't actually sign you in.

Select-AzSubscription -Name $AzContext.Context.Subscription.Name -Context $AzContext.Context

When executing the above code, it should not only have you signed in, but select the proper subscription allowing the rest of your code to execute, but it does not. Again you get WARNING: Unable to acquire token for tenant '6c648512-a417-....'

Additionally,

Save-AzContext -Profile $AzContext -Path $($ProfilePath + $AzContext.Context.Account.Id + "@$Subscription.json") -Force

$AzContext = Import-AzContext -Path $($ProfilePath + $UPN + "@$Subscription.json") -ErrorAction SilentlyContinue

Select-AzSubscription -Name $AzContext.Context.Subscription.Name -Context $AzContext.Context

The code above is also not working the SAME as AzureRm. In previous scripts we successfully used

Select-AzureRmSubscription -Subscription $AzureRmContext.Context.Subscription.Name

...without any issues. This doesn't work for Az.

Module Version

Get-Module -ListAvailable

Environment Data

$PSVersionTable

Debug Output


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions