Skip to content
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

PowerShell functions are defaulting to AzureCloud, not the cloud they are running in. #972

Open
idotColinBlair opened this issue Jul 25, 2023 · 0 comments
Assignees
Labels

Comments

@idotColinBlair
Copy link

I spent a lot of time having issues getting my PowerShell functions to work. What I finally realized is that they thought they were running in AzureCloud when they were actually running in AzureUsGovernment.

A simple suggestion to fix this for future users would be to modify the profile.ps1 file to set the Environment to AzureCloud explicitly. That way there is an obvious setting that needs to be modified.

if ($env:MSI_SECRET) {
    Disable-AzContextAutosave -Scope Process | Out-Null
    Connect-AzAccount -Identity -Environment AzureCloud -ErrorAction Stop
    # Get-AzSubscription -SubscriptionId <SubscriptionId> -ErrorAction Stop | Set-AzContext -ErrorAction Stop 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants