File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -100,10 +100,8 @@ function Invoke-ExecApiClient {
100100 }
101101 ' GetAzureConfiguration' {
102102 $Owner = $env: WEBSITE_OWNER_NAME
103- $RGName = $env: WEBSITE_RESOURCE_GROUP
104- if (! $RGName ) {
105- $RGName = $Owner -split ' \+' | Select-Object - Last 1
106- $RGName = $RGName -replace ' -[^-]+$' , ' '
103+ if ($Owner -match ' ^(?<SubscriptionId>[^+]+)\+(?<RGName>[^-]+(?:-[^-]+)*?)(?:-[^-]+webspace(?:-Linux)?)?$' ) {
104+ $RGName = $Matches.RGName
107105 }
108106 $FunctionAppName = $env: WEBSITE_SITE_NAME
109107 try {
@@ -121,10 +119,9 @@ function Invoke-ExecApiClient {
121119 }
122120 ' SaveToAzure' {
123121 $TenantId = $env: TenantId
124- $RGName = $env: WEBSITE_RESOURCE_GROUP
125- if (! $RGName ) {
126- $RGName = $Owner -split ' \+' | Select-Object - Last 1
127- $RGName = $RGName -replace ' -[^-]+$' , ' '
122+ $Owner = $env: WEBSITE_OWNER_NAME
123+ if ($Owner -match ' ^(?<SubscriptionId>[^+]+)\+(?<RGName>[^-]+(?:-[^-]+)*?)(?:-[^-]+webspace(?:-Linux)?)?$' ) {
124+ $RGName = $Matches.RGName
128125 }
129126 $FunctionAppName = $env: WEBSITE_SITE_NAME
130127 $AllClients = Get-CIPPAzDataTableEntity @Table - Filter ' Enabled eq true' | Where-Object { ! [string ]::IsNullOrEmpty($_.RowKey ) }
Original file line number Diff line number Diff line change @@ -18,11 +18,9 @@ Function Invoke-ExecBackendURLs {
1818 # Write to the Azure Functions log stream.
1919 Write-Host ' PowerShell HTTP trigger function processed a request.'
2020
21- $RGName = $env: WEBSITE_RESOURCE_GROUP
22- if (! $RGName ) {
23- $Owner = $env: WEBSITE_OWNER_NAME
24- $RGName = $Owner -split ' \+' | Select-Object - Last 1
25- $RGName = $RGName -replace ' -[^-]+$' , ' '
21+ $Owner = $env: WEBSITE_OWNER_NAME
22+ if ($Owner -match ' ^(?<SubscriptionId>[^+]+)\+(?<RGName>[^-]+(?:-[^-]+)*?)(?:-[^-]+webspace(?:-Linux)?)?$' ) {
23+ $RGName = $Matches.RGName
2624 }
2725
2826 $results = [PSCustomObject ]@ {
You can’t perform that action at this time.
0 commit comments