Azure / Azure/azure-functions-powershell-worker

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

Open
#972 0 comments 0 reactions 1 assignee Claimed by @Francisco-Gamino View on GitHub
P2
Dominant language
C#
Stars
215
Forks
61
Avg merge
21h 4m
Merged PRs (30d)
6

Description

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.

```powershell
if ($env:MSI_SECRET) {
Disable-AzContextAutosave -Scope Process | Out-Null
Connect-AzAccount -Identity -Environment AzureCloud -ErrorAction Stop
# Get-AzSubscription -SubscriptionId -ErrorAction Stop | Set-AzContext -ErrorAction Stop
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.