Skip to content

Credentials Expired? #7956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ronbok opened this issue Nov 29, 2018 · 1 comment
Closed

Credentials Expired? #7956

ronbok opened this issue Nov 29, 2018 · 1 comment

Comments

@ronbok
Copy link

ronbok commented Nov 29, 2018

Description

Your Azure credentials have not been set up or have expired, please run Connect-AzureRmAccount to set up your Azure credentials.

Despite this being Az, not AzureRM, we get an error that tells you to use Connect-AzureRmAccount?

Also, this code worked fine on Windows, Windows PowerShell, using AzureRm. When reloading the saved file, it's not logging you back in

Script/Steps for Reproduction

#region Login-Az()

Function Login-Az()
{
Param ([String]$Subscription, [String]$UPN)

$ProfilePath = (Split-Path $Profile.CurrentUserCurrentHost) + "/"

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

If ([string]::IsNullOrEmpty($AzContext))

{

    $AzContext = Connect-AzAccount -Subscription $Subscription -Environment "AzureCloud"
    Save-AzContext -Profile $AzContext -Path $($ProfilePath + $AzContext.Context.Account.Id + "@$Subscription.json") -Force
    # Get-AzureRmContext

}
Else
{
    Select-AzSubscription -Name $AzContext.Context.Subscription.Name -Context $AzContext.Context
    
}

Return $AzContext

}
#endregion Login-Az()

Module Version

Get-Module -ListAvailable

Environment Data

$PSVersionTable

Debug Output


@ronbok
Copy link
Author

ronbok commented Nov 29, 2018

This is related to these open / closed issues and a bug fix appears to be on its way.

#7110

#7456

#7949

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant