File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
Modules/CIPPCore/Public/Authentication Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 11function Get-CippApiAuth {
2- Param (
2+ param (
33 [string ]$RGName ,
44 [string ]$FunctionAppName
55 )
66
77 if ($env: MSI_SECRET ) {
88 Disable-AzContextAutosave - Scope Process | Out-Null
9- $Context = (Connect-AzAccount - Identity).Context
9+ $null = Connect-AzAccount - Identity
10+ $SubscriptionId = $ENV: WEBSITE_OWNER_NAME -split ' \+' | Select-Object - First 1
1011 } else {
1112 $Context = Get-AzContext
13+ $SubscriptionId = $Context.Subscription.Id
1214 }
13- # Get subscription id
14- $SubscriptionId = $Context.Subscription.Id
1515
1616 # Get auth settings
1717 $AuthSettings = Invoke-AzRestMethod - Uri " https://management.azure.com/subscriptions/$SubscriptionId /resourceGroups/$RGName /providers/Microsoft.Web/sites/$ ( $FunctionAppName ) /config/authsettingsV2/list?api-version=2020-06-01" - ErrorAction Stop | Select-Object - ExpandProperty Content | ConvertFrom-Json
Original file line number Diff line number Diff line change @@ -14,9 +14,8 @@ function Set-CippApiAuth {
1414 $Context = Set-AzContext - SubscriptionId $SubscriptionId
1515 } else {
1616 $Context = Get-AzContext
17+ $SubscriptionId = $Context.Subscription.Id
1718 }
18- # Get subscription id
19- $SubscriptionId = $Context.Subscription.Id
2019
2120 # Get auth settings
2221 $AuthSettings = Invoke-AzRestMethod - Uri " https://management.azure.com/subscriptions/$SubscriptionId /resourceGroups/$RGName /providers/Microsoft.Web/sites/$ ( $FunctionAppName ) /config/authsettingsV2/list?api-version=2020-06-01" | Select-Object - ExpandProperty Content | ConvertFrom-Json
You can’t perform that action at this time.
0 commit comments