Edit

Share via


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.

Screenshot of the Deploy to Azure button to deploy resources with a template.

Prerequisites

  • 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.

Review the template

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:

Deploy the template

Deploy the template using any standard method for deploying an ARM template such as the following examples using Azure CLI and PowerShell.

  1. Save the template file as azuredeploy.json to your local computer.

  2. 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.

Review deployed resources

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.

  1. In the Azure portal, search for and select API Centers, and select the API center that you created.
  2. Review the properties of your service on the Overview page.
  3. In the left menu, under Assets, select APIs to see the API that you registered in the default workspace.

Next steps

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.