Quickstart: Create your API center - ARM template
Create your API center to start an inventory of your organization's APIs. Azure API Center enables tracking APIs in a centralized location for discovery, reuse, and governance.
After creating your API center, follow the steps in the tutorials to add custom metadata, APIs, versions, definitions, and other information.
An Azure Resource Manager template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. The template uses declarative syntax. You describe your intended deployment without writing the sequence of programming commands to create the deployment.
If your environment meets the prerequisites and you're familiar with using ARM templates, select the Deploy to Azure button. The template will open in the Azure portal.
If you don't have an Azure subscription, create an Azure free account before you begin.
At least a Contributor role assignment or equivalent permissions in the Azure subscription.
For Azure CLI:
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.
For Azure PowerShell:
- If you choose to use Azure PowerShell locally:
- Install the latest version of the Az PowerShell module.
- Connect to your Azure account using the Connect-AzAccount cmdlet.
- If you choose to use Azure Cloud Shell:
- See Overview of Azure Cloud Shell for more information.
- If you choose to use Azure PowerShell locally:
The template used in this quickstart is from Azure Quickstart Templates.
In this example, the template creates an API center in the Free plan and registers a sample API in the default workspace. Currently, API Center supports a single, default workspace for all child resources.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.27.1.19265",
"templateHash": "14017048781723650556"
}
},
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Specifies the location for resources."
}
},
"apiCenterName": {
"type": "string",
"defaultValue": "[format('apicenter{0}', uniqueString(resourceGroup().id))]",
"metadata": {
"description": "The name of the API center."
}
},
"apiName": {
"type": "string",
"defaultValue": "first-api",
"metadata": {
"description": "The name of an API to register in the API center."
}
},
"apiType": {
"type": "string",
"defaultValue": "rest",
"allowedValues": [
"rest",
"soap",
"graphql",
"grpc",
"webhook",
"websocket"
],
"metadata": {
"description": "The type of the API to register in the API center."
}
}
},
"resources": [
{
"type": "Microsoft.ApiCenter/services",
"apiVersion": "2024-03-01",
"name": "[parameters('apiCenterName')]",
"location": "[parameters('location')]",
"properties": {}
},
{
"type": "Microsoft.ApiCenter/services/workspaces",
"apiVersion": "2024-03-01",
"name": "[format('{0}/{1}', parameters('apiCenterName'), 'default')]",
"properties": {
"title": "Default workspace",
"description": "Default workspace"
},
"dependsOn": [
"[resourceId('Microsoft.ApiCenter/services', parameters('apiCenterName'))]"
]
},
{
"type": "Microsoft.ApiCenter/services/workspaces/apis",
"apiVersion": "2024-03-01",
"name": "[format('{0}/{1}/{2}', parameters('apiCenterName'), 'default', parameters('apiName'))]",
"properties": {
"title": "[parameters('apiName')]",
"kind": "[parameters('apiType')]",
"externalDocumentation": [
{
"description": "API Center documentation",
"title": "API Center documentation",
"url": "https://learn.microsoft.com/azure/api-center/overview"
}
],
"contacts": [
{
"email": "apideveloper@contoso.com",
"name": "API Developer",
"url": "https://learn.microsoft.com/azure/api-center/overview"
}
],
"customProperties": {},
"summary": "This is a test API, deployed using a template!",
"description": "This is a test API, deployed using a template!"
},
"dependsOn": [
"[resourceId('Microsoft.ApiCenter/services/workspaces', parameters('apiCenterName'), 'default')]"
]
}
]
}
The following Azure resources are defined in the template:
- Microsoft.ApiCenter/services
- Microsoft.ApiCenter/services/workspaces
- Microsoft.ApiCenter/services/workspaces/apis
Deploy the template using any standard method for deploying an ARM template such as the following examples using Azure CLI and PowerShell.
Save the template file as azuredeploy.json to your local computer.
Deploy the template using either Azure CLI or Azure PowerShell.
# Create a resource group in one of the supported regions for Azure API Center az group create --name exampleRG --location eastus az deployment group create --resource-group exampleRG --template-file azuredeploy.json --parameters apiName="<api-name>" apiType="<api-type>"
Replace <api-name> and <api-type> with the name and type of an API that you want to register in your API center.
When the deployment finishes, you should see a message indicating the deployment succeeded.
Use the Azure portal to check the deployed resources, or use tools such as the Azure CLI or Azure PowerShell to list the deployed resources.
- In the Azure portal, search for and select API Centers, and select the API center that you created.
- Review the properties of your service on the Overview page.
- In the left menu, under Assets, select APIs to see the API that you registered in the default workspace.
Now you can start adding information to the inventory in your API center. To help you organize your APIs and other information, begin by defining custom metadata in your API center.