Skip to content

Commit bc881cf

Browse files
authored
Merge pull request #163 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents f1738a6 + 26d556b commit bc881cf

File tree

12 files changed

+32
-10
lines changed

12 files changed

+32
-10
lines changed

Modules/CIPPCore/Public/Authentication/Set-CippApiAuth.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function Set-CippApiAuth {
22
[CmdletBinding(SupportsShouldProcess)]
3-
Param(
3+
param(
44
[string]$RGName,
55
[string]$FunctionAppName,
66
[string]$TenantId,
@@ -9,7 +9,9 @@ function Set-CippApiAuth {
99

1010
if ($env:MSI_SECRET) {
1111
Disable-AzContextAutosave -Scope Process | Out-Null
12-
$Context = (Connect-AzAccount -Identity).Context
12+
$null = Connect-AzAccount -Identity
13+
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
14+
$Context = Set-AzContext -SubscriptionId $SubscriptionId
1315
} else {
1416
$Context = Get-AzContext
1517
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup/Invoke-ExecSAMSetup.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ Function Invoke-ExecSAMSetup {
5151
} else {
5252
if ($env:MSI_SECRET) {
5353
Disable-AzContextAutosave -Scope Process | Out-Null
54-
$AzSession = Connect-AzAccount -Identity
54+
$null = Connect-AzAccount -Identity
55+
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
56+
$null = Set-AzContext -SubscriptionId $SubscriptionId
5557
}
5658
}
5759
if (!$ENV:SetFromProfile) {

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using namespace System.Net
22

3-
Function Invoke-AddStandardsTemplate {
3+
function Invoke-AddStandardsTemplate {
44
<#
55
.FUNCTIONALITY
66
Entrypoint,AnyTenant
@@ -31,7 +31,7 @@ Function Invoke-AddStandardsTemplate {
3131

3232
}
3333
Write-LogMessage -headers $Request.Headers -API $APINAME -message "Created CA Template $($Request.body.name) with GUID $GUID" -Sev 'Debug'
34-
$body = [pscustomobject]@{'Results' = 'Successfully added template'; id = $GUID }
34+
$body = [pscustomobject]@{'Results' = 'Successfully added template'; Metadata = @{id = $GUID } }
3535

3636
# Associate values to output bindings by calling 'Push-OutputBinding'.
3737
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{

Modules/CIPPCore/Public/Entrypoints/Timer Functions/Start-UpdateTokensTimer.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ function Start-UpdateTokensTimer {
2525
} else {
2626
if ($env:MSI_SECRET) {
2727
Disable-AzContextAutosave -Scope Process | Out-Null
28-
$AzSession = Connect-AzAccount -Identity
28+
$null = Connect-AzAccount -Identity
29+
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
30+
$null = Set-AzContext -SubscriptionId $SubscriptionId
2931
}
3032
$KV = ($ENV:WEBSITE_DEPLOYMENT_ID -split '-')[0]
3133
if ($Refreshtoken) {

Modules/CIPPCore/Public/Get-CIPPAuthentication.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function Get-CIPPAuthentication {
2020
}
2121
} else {
2222
Connect-AzAccount -Identity
23+
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
24+
$null = Set-AzContext -SubscriptionId $SubscriptionId
2325
$keyvaultname = ($ENV:WEBSITE_DEPLOYMENT_ID -split '-')[0]
2426
$Variables | ForEach-Object {
2527
Set-Item -Path ENV:$_ -Value (Get-AzKeyVaultSecret -VaultName $keyvaultname -Name $_ -AsPlainText -ErrorAction Stop) -Force

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAppDeploy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function Invoke-CIPPStandardAppDeploy {
6969
}
7070

7171
if ($Settings.report -eq $true) {
72-
$StateIsCorrect = $MissingApps.Count -eq 0 ? $true : $MissingApps
72+
$StateIsCorrect = $MissingApps.Count -eq 0 ? $true : @{appids = $MissingApps -join ',' }
7373
Set-CIPPStandardsCompareField -FieldName 'standards.AppDeploy' -FieldValue $StateIsCorrect -TenantFilter $tenant
7474
Add-CIPPBPAField -FieldName 'AppDeploy' -FieldValue $StateIsCorrect -StoreAs bool -Tenant $tenant
7575
}

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardTeamsMessagingPolicy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Function Invoke-CIPPStandardTeamsMessagingPolicy {
9797
}
9898
}
9999

100-
if ($Setings.report -eq $true) {
100+
if ($Settings.report -eq $true) {
101101
Add-CIPPBPAField -FieldName 'TeamsMessagingPolicy' -FieldValue $StateIsCorrect -StoreAs bool -Tenant $Tenant
102102

103103
if ($StateIsCorrect) {

Modules/CIPPCore/Public/Test-CIPPAccessPermissions.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ function Test-CIPPAccessPermissions {
3434
if ($env:MSI_SECRET) {
3535
try {
3636
Disable-AzContextAutosave -Scope Process | Out-Null
37-
$AzSession = Connect-AzAccount -Identity
37+
$null = Connect-AzAccount -Identity
38+
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
39+
$null = Set-AzContext -SubscriptionId $SubscriptionId
3840

3941
$KV = $ENV:WEBSITE_DEPLOYMENT_ID
4042
$KeyVaultRefresh = Get-AzKeyVaultSecret -VaultName $kv -Name 'RefreshToken' -AsPlainText

Modules/CippExtensions/Public/Extension Functions/Get-ExtensionAPIKey.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ function Get-ExtensionAPIKey {
2222
} else {
2323
$keyvaultname = ($ENV:WEBSITE_DEPLOYMENT_ID -split '-')[0]
2424
$null = Connect-AzAccount -Identity
25+
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
26+
$null = Set-AzContext -SubscriptionId $SubscriptionId
2527
$APIKey = (Get-AzKeyVaultSecret -VaultName $keyvaultname -Name $Extension -AsPlainText)
2628
}
2729
Set-Item -Path "ENV:$Var" -Value $APIKey -Force -ErrorAction SilentlyContinue

Modules/CippExtensions/Public/Extension Functions/Set-ExtensionAPIKey.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ function Set-ExtensionAPIKey {
2525
} else {
2626
$keyvaultname = ($ENV:WEBSITE_DEPLOYMENT_ID -split '-')[0]
2727
$null = Connect-AzAccount -Identity
28+
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
29+
$null = Set-AzContext -SubscriptionId $SubscriptionId
2830
$null = Set-AzKeyVaultSecret -VaultName $keyvaultname -Name $Extension -SecretValue (ConvertTo-SecureString -AsPlainText -Force -String $APIKey)
2931
}
3032
Set-Item -Path "ENV:$Var" -Value $APIKey -Force -ErrorAction SilentlyContinue

0 commit comments

Comments
 (0)