Skip to content

Files

Latest commit

99eb46c · Mar 30, 2022

History

History
111 lines (83 loc) · 6.03 KB

powershell-create-service-instance.md

File metadata and controls

111 lines (83 loc) · 6.03 KB
title description services documentationcenter author ms.service ms.topic ms.custom ms.date ms.author
Quickstart - Create Azure API Management instance using PowerShell | Microsoft Docs
Create a new Azure API Management instance by using Azure PowerShell.
api-management
dlepow
api-management
quickstart
mvc, devx-track-azurepowershell, mode-api, devdivchpfy22
03/30/2022
danlep

Quickstart: Create a new Azure API Management service instance by using PowerShell

Azure API Management (APIM) helps organizations publish APIs to external, partner, and internal developers to unlock the potential of their data and services. API Management provides the core competencies to ensure a successful API program through developer engagement, business insights, analytics, security, and protection. APIM lets you create and manage modern API gateways for existing backend services hosted anywhere. For more information, see the Overview.

This quickstart describes the steps for creating a new API Management instance by using Azure PowerShell cmdlets.

[!INCLUDE quickstarts-free-trial-note]

[!INCLUDE updated-for-az]

[!INCLUDE cloud-shell-try-it.md]

If you choose to install and use the PowerShell locally, this tutorial requires the Azure PowerShell module version 1.0 or later. Run Get-Module -ListAvailable Az to find the version. If you need to upgrade, see Install Azure PowerShell module. If you're running PowerShell locally, you also need to run Connect-AzAccount to create a connection with Azure.

Create resource group

Create an Azure resource group with New-AzResourceGroup. A resource group is a logical container into which Azure resources are deployed and managed.

The following command creates a resource group named myResourceGroup in the West US location:

New-AzResourceGroup -Name myResourceGroup -Location WestUS

Create an API Management service

Now that you have a resource group, you can create an API Management service instance. Create one by using New-AzApiManagement and provide a service name and publisher details. The service name must be unique within Azure.

In the following example, myapim is used for the service name. Update the name to a unique value. Also, update the organization name of the API publisher and the admin email address to receive notifications.

By default, the command creates the instance in the Developer tier, an economical option to evaluate Azure API Management. This tier isn't for production use. For more information about scaling the API Management tiers, see upgrade and scale.

Note

This is a long-running action. It can take between 30 and 40 minutes to create and activate an API Management service in this tier.

New-AzApiManagement -Name "myapim" -ResourceGroupName "myResourceGroup" `
  -Location "West US" -Organization "Contoso" -AdminEmail "admin@contoso.com" 

When the command returns, run Get-AzApiManagement to view the properties of the Azure API Management service. After activation, the setting up status is Succeeded and the service instance has several associated URLs. For example:

Get-AzApiManagement -Name "myapim" -ResourceGroupName "myResourceGroup" 

Example output:

PublicIPAddresses                     : {203.0.113.1}
PrivateIPAddresses                    :
Id                                    : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ApiManagement/service/myapim
Name                                  : myapim
Location                              : West US
Sku                                   : Developer
Capacity                              : 1
CreatedTimeUtc                        : 9/9/2020 9:07:43 PM
ProvisioningState                     : Succeeded
RuntimeUrl                            : https://myapim.azure-api.net
RuntimeRegionalUrl                    : https://myapi-westus-01.regional.azure-api.net
PortalUrl                             : https://myapim.portal.azure-api.net
DeveloperPortalUrl                    : https://myapim.developer.azure-api.net
ManagementApiUrl                      : https://myapim.management.azure-api.net
ScmUrl                                : https://myapim.scm.azure-api.net
PublisherEmail                        : admin@contoso.com
OrganizationName                      : Contoso
NotificationSenderEmail               : apimgmt-noreply@mail.windowsazure.com
VirtualNetwork                        :
VpnType                               : None
PortalCustomHostnameConfiguration     :
ProxyCustomHostnameConfiguration      : {myapim.azure-api.net}
ManagementCustomHostnameConfiguration :
ScmCustomHostnameConfiguration        :
DeveloperPortalHostnameConfiguration  :
SystemCertificates                    :
Tags                                  : {}
AdditionalRegions                     : {}
SslSetting                            : Microsoft.Azure.Commands.ApiManagement.Models.PsApiManagementSslSetting
Identity                              :
EnableClientCertificate               :
ResourceGroupName                     : myResourceGroup

After your API Management service instance is deployed, you're ready to use it. Start with the tutorial to import and publish your first API.

Clean up resources

When no longer needed, you can use the Remove-AzResourceGroup command to remove the resource group and all related resources.

Remove-AzResourceGroup -Name myResourceGroup

Next steps

[!div class="nextstepaction"] Import and publish your first API