From 170f6d6c53c2d0b145027e8fa621e2cd480322ef Mon Sep 17 00:00:00 2001 From: Pim Simons Date: Fri, 26 Aug 2022 10:25:13 +0200 Subject: [PATCH 1/2] fixed casing of parameter --- .../Scripts/Import-AzApiManagementApiPolicy.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementApiPolicy.ps1 b/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementApiPolicy.ps1 index 52aa9702..b44cfc49 100644 --- a/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementApiPolicy.ps1 +++ b/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementApiPolicy.ps1 @@ -2,7 +2,7 @@ param( [Parameter(Mandatory = $true)][string] $ResourceGroupName, [Parameter(Mandatory = $true)][string] $ServiceName, [Parameter(Mandatory = $true)][string] $ApiId, - [Parameter(Mandatory = $true)][string] $policyFilePath + [Parameter(Mandatory = $true)][string] $PolicyFilePath ) $apim = Get-AzApiManagement -ResourceGroupName $ResourceGroupName -Name $ServiceName @@ -12,7 +12,7 @@ if ($apim -eq $null) { $apimContext = New-AzApiManagementContext -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName Write-Host "Updating policy of API '$ApiId'" -$result = Set-AzApiManagementPolicy -Context $apimContext -ApiId $ApiId -PolicyFilePath $policyFilePath +$result = Set-AzApiManagementPolicy -Context $apimContext -ApiId $ApiId -PolicyFilePath $PolicyFilePath if ($result) { Write-Host "Successfully updated API policy" } else { From 0808c3fd646bc9eb1fb1c72701c8ca65e4ebf6aa Mon Sep 17 00:00:00 2001 From: Pim Simons Date: Fri, 26 Aug 2022 11:19:12 +0200 Subject: [PATCH 2/2] added -PassThru to make sure the boolean is returned from the Set-AzApiManagementPolicy command --- .../Scripts/Import-AzApiManagementApiPolicy.ps1 | 2 +- .../Scripts/Import-AzApiManagementOperationPolicy.ps1 | 2 +- .../Scripts/Import-AzApiManagementProductPolicy.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementApiPolicy.ps1 b/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementApiPolicy.ps1 index b44cfc49..3816a545 100644 --- a/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementApiPolicy.ps1 +++ b/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementApiPolicy.ps1 @@ -12,7 +12,7 @@ if ($apim -eq $null) { $apimContext = New-AzApiManagementContext -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName Write-Host "Updating policy of API '$ApiId'" -$result = Set-AzApiManagementPolicy -Context $apimContext -ApiId $ApiId -PolicyFilePath $PolicyFilePath +$result = Set-AzApiManagementPolicy -Context $apimContext -ApiId $ApiId -PolicyFilePath $PolicyFilePath -PassThru if ($result) { Write-Host "Successfully updated API policy" } else { diff --git a/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementOperationPolicy.ps1 b/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementOperationPolicy.ps1 index 6b68494c..2a34db6c 100644 --- a/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementOperationPolicy.ps1 +++ b/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementOperationPolicy.ps1 @@ -13,7 +13,7 @@ if ($apim -eq $null) { $apimContext = New-AzApiManagementContext -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName Write-Host "Updating policy of the operation '$OperationId' in API '$ApiId'" -$result = Set-AzApiManagementPolicy -Context $apimContext -ApiId $ApiId -OperationId $OperationId -PolicyFilePath $PolicyFilePath +$result = Set-AzApiManagementPolicy -Context $apimContext -ApiId $ApiId -OperationId $OperationId -PolicyFilePath $PolicyFilePath -PassThru if ($result) { Write-Host "Successfully updated the operation policy" } else { diff --git a/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementProductPolicy.ps1 b/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementProductPolicy.ps1 index f65d0122..4d11648f 100644 --- a/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementProductPolicy.ps1 +++ b/src/Arcus.Scripting.ApiManagement/Scripts/Import-AzApiManagementProductPolicy.ps1 @@ -12,7 +12,7 @@ if ($apim -eq $null) { $apimContext = New-AzApiManagementContext -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName Write-Host "Updating policy of product '$ProductId'" -$result = Set-AzApiManagementPolicy -Context $apimContext -ProductId $ProductId -PolicyFilePath $PolicyFilePath +$result = Set-AzApiManagementPolicy -Context $apimContext -ProductId $ProductId -PolicyFilePath $PolicyFilePath -PassThru if ($result) { Write-Host "Successfully updated the product policy" } else {