ARM テンプレートを使用して Azure Maps アカウントを作成する

Azure Resource Manager (ARM) テンプレートを使用して Azure Maps アカウントを作成できます。 アカウントを取得したら、Web サイトまたはモバイル アプリケーションで API を実装できます。

Azure Resource Manager テンプレートは JavaScript Object Notation (JSON) ファイルであり、プロジェクトのインフラストラクチャと構成が定義されています。 このテンプレートでは、宣言型の構文が使用されています。 デプロイしようとしているものを、デプロイを作成する一連のプログラミング コマンドを記述しなくても記述できます。

環境が前提条件を満たしていて、ARM テンプレートの使用に慣れている場合は、 [Azure へのデプロイ] ボタンを選択します。 テンプレートが Azure portal で開きます。

Resource Manager テンプレートを Azure にデプロイするボタン。

前提条件

この記事を完了するには:

  • Azure サブスクリプションをお持ちでない場合は、開始する前に 無料アカウント を作成してください。

テンプレートを確認する

このクイックスタートで使用されるテンプレートは Azure クイックスタート テンプレートからのものです。

{
  "$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')]"
    }
  ]
}

Azure Maps リソースはこのテンプレートで定義されています。

テンプレートのデプロイ

  1. Azure にサインインし、テンプレートを開くには次のイメージを選択します。 このテンプレートによって Azure Maps アカウントが作成されます。

    Resource Manager テンプレートを Azure に配置するボタン。

  2. 次の値を選択または入力します。

    ARM テンプレート デプロイのポータル

    特に明記されていない場合は、既定値を使用して Azure Maps アカウントを作成してください。

    • サブスクリプション: Azure サブスクリプションを選択します。
    • リソース グループ: [新規作成] を選択し、リソース グループの一意の名前を入力し、 [OK] を選択します。
    • 場所: 場所を選択します。
    • アカウント名: Azure Maps アカウントの名前を入力します。この名前はグローバルに一意である必要があります。
    • 価格レベル: 適切な価格レベルを選択します。テンプレートの既定値は G2 です。
  3. [Review + create](レビュー + 作成) を選択します。

  4. [確認] ページで設定を確認し、[作成] を選択します。 正常にデプロイされると、次の通知が表示されます。

    ARM テンプレート デプロイのポータル通知

テンプレートをデプロイするには Azure portal を使用します。 Azure PowerShell、Azure CLI、および REST API を使用することもできます。 他のデプロイ方法については、「テンプレートのデプロイ」を参照してください。

デプロイされているリソースを確認する

Azure portal を使用して、Azure Maps アカウントを確認し、キーを表示できます。 次の Azure CLI スクリプトを使用して、アカウント キーを一覧表示することもできます。

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

リソースをクリーンアップする

不要になったリソース グループは削除してください。リソース グループを削除すると、Azure Maps アカウントも削除されます。 Azure CLI を使用してリソース グループを削除するには、次を実行します。

az group delete --name MyResourceGroup

次のステップ

Azure Maps と Azure Resource Manager の詳細については、次の記事を参照してください。