特定のユーザーとして認証するすべての証明書を含むマスターキー格納域を作成しようとしています。ARMテンプレートのKeyVaultリファレンスに関する問題
私は2つのサービスプリンシパルを持っています=>私のアプリケーション用に1つ、配備用に1つです。 アイデアは、展開サービスプリンシパルがキーボルトへのアクセス権を取得し、そこにある証明書をWebアプリケーションのストアに追加するという考え方です。
私はサービスプリンシパルを作成しました。私は彼にキーボルトに関するすべての権限を与えました。また、私はその鍵保管庫のARMテンプレートでアクセス秘密を有効にしました。
私は、Deploying SPとしてログインし、秘密(証明書)を取得することができます。
ただし、キー格納域への参照を含むARMテンプレートを配備する場合は、この機能は動作しません。私は、次のエラーを得た:
New-AzureRmResourceGroupDeployment : 11:16:44 - Resource Microsoft.Web/certificates 'test-certificate' failed with message '{ "Code": "BadRequest", "Message": "The service does not have access to '/subscriptions/98f06e7e-1016-4088-843f-62690f3bb306/resourcegroups/rg-temp/providers/microsoft.keyvault/vaults/master-key-vault' Key Vault. Please make sure that you have granted necessary permissions to the service to perform the request operation.", "Target": null, "Details": [ { "Message": "The service does not have access to '/subscriptions/xxxx/resourcegroups/xxx/providers/microsoft.keyvault/vaults/master-key-vault' Key Vault. Please make sure that you have granted necessary permissions to the service to perform the request operation." },
マイARMテンプレートは次のようになります。
{
"type":"Microsoft.Web/certificates",
"name":"test-certificate",
"apiVersion":"2016-03-01",
"location":"[resourceGroup().location]",
"properties":{
"keyVaultId":"[resourceId('rg-temp', 'Microsoft.KeyVault/vaults', 'master-key-vault')]",
"keyVaultSecretName":"kv-certificate-test",
"serverFarmId":"[resourceId('Microsoft.Web/serverfarms', 'asp-test')]"
}
},
これはバグですか? (ノート、ARMテンプレート内のリソース以外のリソースグループ内のキーボールトの生活)
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type":"Microsoft.Web/certificates",
"name":"test-certificate",
"apiVersion":"2016-03-01",
"location":"[resourceGroup().location]",
"properties":{
"keyVaultId":"/subscriptions/xxx/resourceGroups/rg-temp/providers/Microsoft.KeyVault/vaults/xxx",
"keyVaultSecretName":"testcert",
"serverFarmId":"[resourceId('Microsoft.Web/serverfarms', 'asp-test')]"
}
},
{
"name": "wa-test1",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2016-08-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', 'asp-test')]"
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/asp-test')]": "Resource",
"displayName": "wa-test1"
},
"properties": {
"name": "wa-test1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'asp-test')]"
}
},
{
"name": "asp-test",
"type": "Microsoft.Web/serverfarms",
"location": "[resourceGroup().location]",
"apiVersion": "2014-06-01",
"dependsOn": [],
"tags": {
"displayName": "appServicePlan"
},
"properties": {
"name": "asp-test",
"sku": "Free",
"workerSize": "Small",
"numberOfWorkers": 1
}
}
],
"outputs": {}
}
:これは私のARMテンプレート
$key = Get-AzureKeyVaultSecret -VaultName "master-key-vault" -Name "testenvironmentcertificate"
です:私はとのデプロイSPを使用して証明書を取得することができていますので
セットAzureRmKeyVaultAccessPolicy:WebAppのは、あなたがキー保管庫へのRPのアクセスを許可する必要があり、それを行うために、独自のリソース・プロバイダを使用しているので、
をテンプレートを共有することができますか?あなたは機密情報を削除することができます – 4c74356b41
私は自分の質問を編集しました:) – Identity
一見したところ、これはうまく見えますが、何が間違っているのか分かりません、別の鍵金庫を作成して、テンプレート(そして管理者がkeyvaultに対するすべての権利を持っていることを確認し、keyvaultはテンプレートの配布を許可していますか?) – 4c74356b41