generated from arcus-azure/arcus.github.template
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature - remove API Management defaults script (#51)
Co-authored-by: Tom Kerkhove <[email protected]>
- Loading branch information
1 parent
363abaa
commit ab30541
Showing
7 changed files
with
223 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+2.8 KB
(200%)
src/Arcus.Scripting.ApiManagement/Arcus.Scripting.ApiManagement.psd1
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Arcus.Scripting.ApiManagement/Scripts/Remove-AzApiManagementDefaults.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
param( | ||
[string][parameter(Mandatory = $true)] $ResourceGroup, | ||
[string][parameter(Mandatory = $true)] $ServiceName | ||
) | ||
|
||
Write-Host "Start removing Azure API Management defaults..." | ||
$apimContext = New-AzApiManagementContext -ResourceGroupName $ResourceGroup -ServiceName $ServiceName | ||
|
||
Write-Host "Removing Echo Api..." | ||
$apiResult = Remove-AzApiManagementApi -Context $apimContext -ApiId 'echo-api' | ||
|
||
Write-Host "Removing Starter product..." | ||
$starterResult = Remove-AzApiManagementProduct -Context $apimContext -ProductId 'starter' -DeleteSubscriptions | ||
|
||
Write-Host "Removing Unlimited product..." | ||
$unlimitedResult = Remove-AzApiManagementProduct -Context $apimContext -ProductId 'unlimited' -DeleteSubscriptions | ||
|
||
if ($apiResult -and $starterResult -and $unlimitedResult) { | ||
Write-Host "Successfully removed the 'echo-api' API, 'starter' Product and 'unlimited' Product" | ||
} else { | ||
$message = "Failed to remove API Management defaults" | ||
if (-not $apiResult) { | ||
$message += [System.Environment]::NewLine + "> Failed to remove the 'echo' API" | ||
} | ||
if (-not $starterResult) { | ||
$message += [System.Environment]::NewLine + "> Failed to remove the 'starter' Product" | ||
} | ||
if (-not $unlimitedResult) { | ||
$message += [System.Environment]::NewLine + "> Failed to remove the 'unlimited' Product" | ||
} | ||
|
||
Write-Error $message | ||
} | ||
|
||
Write-Host "Finished removing Azure API Management defaults!" |
Binary file not shown.
Oops, something went wrong.