Quickstart: Create your API center - Bicep

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.

Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. It provides concise syntax, reliable type safety, and support for code reuse. Bicep offers the best authoring experience for your infrastructure-as-code solutions in Azure.

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 Bicep file

The Bicep file used in this quickstart is from Azure Quickstart Templates.

In this example, the Bicep file 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.

@description('Specifies the location for resources.')
param location string = resourceGroup().location

@description('The name of the API center.')
param apiCenterName string = 'apicenter${uniqueString(resourceGroup().id)}'

@description('The name of an API to register in the API center.')
param apiName string = 'first-api'

@description('The type of the API to register in the API center.')
@allowed([
  'rest'
  'soap'
  'graphql'
  'grpc'
  'webhook'
  'websocket'
])
param apiType string = 'rest'

resource apiCenterService 'Microsoft.ApiCenter/services@2024-03-01' = {
  name: apiCenterName
  location: location
  properties: {}
}

resource apiCenterWorkspace 'Microsoft.ApiCenter/services/workspaces@2024-03-01' = {
  parent: apiCenterService
  name: 'default'
  properties: {
    title: 'Default workspace'
    description: 'Default workspace'
  }
}

resource apiCenterAPI 'Microsoft.ApiCenter/services/workspaces/apis@2024-03-01' = {
  parent: apiCenterWorkspace
  name: apiName
  properties: {
    title: apiName
    kind: 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!'
  }
}

The following Azure resources are defined in the Bicep file:

Deploy the Bicep file

You can use Azure CLI or Azure PowerShell to deploy the Bicep file. For more information about deploying Bicep files, see Deploy.

  1. Save the Bicep file as main.bicep to your local computer.

  2. Deploy the Bicep file 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 main.bicep --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.