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.
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:
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:
- Microsoft.ApiCenter/services
- Microsoft.ApiCenter/services/workspaces
- Microsoft.ApiCenter/services/workspaces/apis
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.
Save the Bicep file as main.bicep to your local computer.
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.
- 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.
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.