Azure API Management にカスタムドメインを適用する
📅⏱️約4分
シェア:

この記事は1年以上前に公開されたものです。情報が古くなっている可能性があります。
Azure API Management は、既存のバックエンドのサービスに対して一貫性のある最新の API ゲートウェイを迅速に作成する手段です1。 本記事では、この API Management にカスタムドメインを適用する方法を説明します。また、SSL 化を独自の証明書を使って行う方法を説明します。 さらに、デプロイは CI/CD を意識して、ARM Template 2を使います。
1. Key Vault をデプロイする
まずは証明書を保持するための Key Vault をデプロイしましょう。
json
1{2 "$schema": "https://schema.management.azure.com/schemas/2018-05-01/deploymentTemplate.json#",3 "contentVersion": "1.0.0.0",4 "parameters": {5 "keyVaultName": {6 "type": "string",7 "metadata": {8 "description": "Key Vault Name"9 }10 },11 "apiMgmtName": {12 "type": "string",13 "metadata": {14 "description": "API Management Name"15 }16 },17 "commanderObjectId": {18 "type": "securestring",19 "metadata": {20 "description": "Object id of azure cli command executor."21 }22 }23 },24 "variables": {},25 "resources": [26 {27 "name": "[parameters('apiMgmtName')]",28 "type": "Microsoft.ApiManagement/service",29 "apiVersion": "2019-01-01",30 "properties": {31 "notificationSenderEmail": "apimgmt-noreply@mail.windowsazure.com",32 "hostnameConfigurations": [],33 "publisherEmail": "ch241.sample@example.com",34 "publisherName": "mark241"35 },36 "sku": {37 "name": "Developer"38 },39 "identity": {40 "type": "SystemAssigned"41 },42 "location": "[resourceGroup().location]"43 },44 {45 "name": "[parameters('keyVaultName')]",46 "type": "Microsoft.KeyVault/vaults",47 "apiVersion": "2018-02-14",48 "location": "[resourceGroup().location]",49 "dependsOn": [50 "[resourceId('Microsoft.ApiManagement/service', parameters('apiMgmtName'))]"51 ],52 "properties": {53 "tenantId": "[subscription().tenantId]",54 "sku": {55 "family": "A",56 "name": "standard"57 },58 "accessPolicies": [59 {60 "tenantId": "[subscription().tenantId]",61 "objectId": "[reference(resourceId('Microsoft.ApiManagement/service', parameters('apiMgmtName')), '2019-01-01', 'Full').identity.principalId]",62 "permissions": {63 "keys": [],64 "secrets": ["get"],65 "certificates": ["get"],66 "storage": []67 }68 },69 {70 "tenantId": "[subscription().tenantId]",71 "objectId": "[parameters('commanderObjectId')]",72 "permissions": {73 "keys": [],74 "secrets": [],75 "certificates": ["import"],76 "storage": []77 }78 }79 ],80 "enabledForDeployment": false,81 "enabledForDiskEncryption": false,82 "enabledForTemplateDeployment": false83 },84 "resources": []85 }86 ]87}上記の Template には、Key Vault と API Management のリソースが含まれています。 まずは、API Management を見てみましょう。
json