I am trying to programmatically (via Azure Resource Manager, if possible) create an APIM service in a specific resource group. The goal is that we can have a template or script that is parameterized and can be checked into source control, so that we can duplicate and recreate our environments.
This table in an ARM documentation page says Yes, Resource Manager is Enabled for APIM, but the Quickstart Templates link finds no sample templates for the Microsoft.ApiManagement resource type. However, this could mean merely that no one has yet contributed a template to the gallery, and that I would have to write my own.
As for writing my own ARM template, the article that walks you through authoring a Resource Manager template says:
To learn much of what you need to know about resource providers, see Resource Manager providers, regions, API versions and schemas
... which links back to the same page as my "This table" text above. The same section of the "authoring templates" article also says:
[Properties are] Resource specific configuration settings. The values for the properties are exactly the same as the values you provide in the request body for the REST API operation (PUT method) to create the resource. For links to resource schema documentation or REST API, see Resource Manager providers, regions, API versions and schemas.
... which again links back to the same page as above.
I have checked both the APIM REST API and the azure-resource-manager-schemas page for documentation on how to create an APIM instance.
Is it possible to create an API Management service programmatically, and if so, how?
Yes it is possible to create an ApiManagement service programmatically using the Azure Powershell 1.0 commandlets https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/. Below is the commandlet that will help you achieve it.
PS C:\WINDOWS\system32> get-help New-AzureRmApiManagement -example
NAME
New-AzureRmApiManagement
SYNOPSIS
Creates an API Management deployment.
SYNTAX
New-AzureRmApiManagement [-Capacity [<Int32>]] [-Sku [<PsApiManagementSku>]] [-Tags [<0, Culture=neutral,
PublicKeyToken=b77a5c561934e089>]] -AdminEmail <String> -Location {North Central US | South Central US | Central
US | West Europe | North Europe | West US | East US | East US 2 | Japan East | Japan West | Brazil South |
Southeast Asia | East Asia | Australia East | Australia Southeast} -Name <String> -Organization <String>
-ResourceGroupName <String> [<CommonParameters>]
Example 1: Create at Developer tier API Management service
PS C:\>New-AzureRmApiManagement -ResourceGroupName "ContosoGroup02" -Name "ContosoApi" -Location "Central US"
-Organization "Contoso" -AdminEmail "[email protected]"
This command creates a Developer tier API Management service. The command specifies the organization and the
administrator address. The command does not specify the SKU parameter. Therefore, the cmdlet uses the default
value of Developer.
Example 2: Create a Standard tier service that has three units
PS C:\>New-AzureRmApiManagement -ResourceGroupName "ContosoGroup02 -Name "ContosoApi" -Location "Central US"
-Organization "Contoso" -AdminEmail "[email protected]" -Sku Standard -Capacity 3
This command creates a Standard tier API Management service that has three units.
You can find additional commandlets by using
get-Help AzureRmApiManagement
Full documentation of the commandlets can be found here https://msdn.microsoft.com/en-us/library/mt619282.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With