แก้ไข

แชร์ผ่าน


Create your Azure Maps account using an ARM template

You can create your Azure Maps account using an Azure Resource Manager (ARM) template. After you have an account, you can implement the APIs in your website or mobile application.

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 opens in the Azure portal.

Button to deploy the Resource Manager template to Azure.

Prerequisites

To complete this article:

  • If you don't have an Azure subscription, create a free account before you begin.

Review the template

The template used in this quickstart is from Azure Quickstart Templates.

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.25.53.49325",
      "templateHash": "695164742048978243"
    }
  },
  "parameters": {
    "accountName": {
      "type": "string",
      "defaultValue": "[uniqueString(resourceGroup().id)]",
      "metadata": {
        "description": "The name for your Azure Maps account. This value must be globally unique."
      }
    },
    "location": {
      "type": "string",
      "allowedValues": [
        "westeurope",
        "eastus",
        "westus2",
        "northeurope",
        "westcentralus",
        "usgovvirginia",
        "usgovarizona"
      ],
      "metadata": {
        "description": "Specifies the location for all the resources."
      }
    },
    "pricingTier": {
      "type": "string",
      "defaultValue": "G2",
      "allowedValues": [
        "G2"
      ],
      "metadata": {
        "description": "The pricing tier SKU for the account."
      }
    },
    "kind": {
      "type": "string",
      "defaultValue": "Gen2",
      "allowedValues": [
        "Gen2"
      ],
      "metadata": {
        "description": "The pricing tier for the account."
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.Maps/accounts",
      "apiVersion": "2023-06-01",
      "name": "[parameters('accountName')]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "[parameters('pricingTier')]"
      },
      "kind": "[parameters('kind')]"
    }
  ]
}

The Azure Maps account resource is defined in this template:

Deploy the template

  1. Select the following image to sign in to Azure and open a template. The template creates an Azure Maps account.

    Button to deploy the Resource Manager template to Azure.

  2. Select or enter the following values.

    ARM template deploy portal

    Unless it's specified, use the default value to create your Azure Maps account.

    • Subscription: select an Azure subscription.
    • Resource group: select Create new, enter a unique name for the resource group, and then select OK.
    • Location: select a location.
    • Account Name: enter a name for your Azure Maps account, which must be globally unique.
    • Pricing Tier: select the appropriate pricing tier, the default value for the template is G2.
  3. Select Review + create.

  4. Confirm your settings on the review page and select Create. Once deployed successfully, you get a notification:

    ARM template deploy portal notification

The Azure portal is used to deploy your template. You can also use the Azure PowerShell, Azure CLI, and REST API. To learn other deployment methods, see Deploy templates.

Review deployed resources

You can use the Azure portal to check your Azure Maps account and view your keys. You can also use the following Azure CLI script to list your account keys.

az maps account keys list --name MyMapsAccount --resource-group MyResourceGroup

Clean up resources

When no longer needed, delete the resource group, which also deletes the Azure Maps account. To delete the resource group by using Azure CLI:

az group delete --name MyResourceGroup

Next steps

To learn more about Azure Maps and Azure Resource Manager, see the following articles: