Quickstart: Create a new Azure API Management instance by using the Azure CLI
APPLIES TO: Consumption | Developer | Basic | Standard | Premium
This quickstart describes the steps for creating a new API Management instance by using Azure CLI commands. After creating an instance, you can use the Azure CLI for common management tasks such as importing APIs in your API Management instance.
Azure API Management 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. With API Management, create and manage modern API gateways for existing backend services hosted anywhere.
If you don't have an Azure subscription, create an Azure free account before you begin.
Prerequisites
Use the Bash environment in Azure Cloud Shell. For more information, see Quickstart for Bash in Azure Cloud Shell.
If you prefer to run CLI reference commands locally, install the Azure CLI. If you're running on Windows or macOS, consider running Azure CLI in a Docker container. For more information, see How to run the Azure CLI in a Docker container.
If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For other sign-in options, see Sign in with the Azure CLI.
When you're prompted, install the Azure CLI extension on first use. For more information about extensions, see Use extensions with the Azure CLI.
Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.
- This article requires version 2.11.1 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
Create a resource group
Azure API Management instances, like all Azure resources, must be deployed into a resource group. Resource groups let you organize and manage related Azure resources.
First, create a resource group named myResourceGroup in the Central US location with the following az group create command:
az group create --name myResourceGroup --location centralus
Create an API Management instance
Now that you have a resource group, you can create an API Management instance. Create one by using the az apim create command 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 name of the API publisher's organization and the email address to receive notifications.
az apim create --name myapim --resource-group myResourceGroup \
--publisher-name Contoso --publisher-email admin@contoso.com \
--no-wait
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.
Tip
It can take between 30 and 40 minutes to create and activate an API Management service in this tier. The previous command uses the --no-wait
option so that the command returns immediately while the service is created.
Check the status of the deployment by running the az apim show command:
az apim show --name myapim --resource-group myResourceGroup --output table
Initially, output is similar to the following, showing the Activating
status:
NAME RESOURCE GROUP LOCATION GATEWAY ADDR PUBLIC IP PRIVATE IP STATUS TIER UNITS
----------- ---------------- ---------- -------------- ----------- ------------ ---------- --------- -------
myapim myResourceGroup Central US Activating Developer 1
After activation, the status is Online
and the service instance has a gateway address and public IP address. For now, these addresses don't expose any content. For example:
NAME RESOURCE GROUP LOCATION GATEWAY ADDR PUBLIC IP PRIVATE IP STATUS TIER UNITS
----------- ---------------- ---------- --------------------------------- ------------ ------------ -------- --------- -------
myapim myResourceGroup Central US https://myapim.azure-api.net 203.0.113.1 Online Developer 1
When your API Management service instance is online, you're ready to use it. Start with the tutorial to import and publish your first API.
Clean up resources
You can use the az group delete command to remove the resource group and the API Management service instance when they aren't needed.
az group delete --name myResourceGroup
Next steps
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for