forked from Azure/azure-docs-powershell-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
api-management/backup-restore-apim-service/backup_restore_apim_service.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,42 @@ | ||
########################################################## | ||
# Script to backup and restore api management service. | ||
########################################################### | ||
|
||
$random = (New-Guid).ToString().Substring(0,8) | ||
|
||
#Azure specific details | ||
$subscriptionId = "my-azure-subscription-id" | ||
|
||
# Api Management service specific details | ||
$apimServiceName = "apim-$random" | ||
$resourceGroupName = "apim-rg-$random" | ||
$location = "Japan East" | ||
$organisation = "Contoso" | ||
$adminEmail = "admin@contoso.com" | ||
|
||
# Storage Account details | ||
$storageAccountName = backup_$random | ||
$containerName = "backups" | ||
$backupName = $apimServiceName + ".apimbackup" | ||
|
||
# Select into the ResourceGroup | ||
Select-AzureRmSubscription -SubscriptionId $subscriptionId | ||
|
||
# Create a Resource Group | ||
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location -Force | ||
|
||
# Create storage account | ||
New-AzureRmStorageAccount -StorageAccountName $storageAccountName -Location $location -ResourceGroupName $resourceGroupName -Type Standard_LRS | ||
$storageKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -StorageAccountName $storageAccountName)[0].Value | ||
$storageContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageKey | ||
|
||
# Create API Management service | ||
New-AzureRmApiManagement -ResourceGroupName $resourceGroupName -Location $location -Name $apiManagementName -Organization $organisation -AdminEmail $adminEmail | ||
|
||
# Backup API Management service. | ||
Backup-AzureRmApiManagement -ResourceGroupName $resourceGroupName -Name $apimServiceName -StorageContext $storageContext -TargetContainerName $containerName -TargetBlobName $backupName | ||
|
||
# Restore API Management service | ||
Restore-AzureRmApiManagement -ResourceGroupName $resourceGroupName -Name $apimServiceName -StorageContext $storageContext -SourceContainerName $containerName -SourceBlobName $backupName | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
api-management/import-api-and-add-to-product/import_an_api_and_add_to_product.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