我已经创建了服务主体,并授予了他对密钥库的所有权限。此外,我还在ARM模板中为密钥库启用了访问秘密。
使用powershell,我可以作为部署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."
},
{
"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')]"
}
},
$key = Get-AzureKeyVaultSecret -VaultName "master-key-vault" -Name "testenvironmentcertificate"
{
"$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
}
}
]
}
我认为您缺少资源提供程序访问密钥存储库的权限,因此WebApp正在使用它自己的资源提供程序来实现这一点,您需要授予RP对密钥存储库的访问权限:
Set-AzureRmKeyVaultAccessPolicy -VaultName KEYVAULTNAME -PermissionsToSecrets get `
-ServicePrincipalName abfa0a7c-a6b6-4736-8310-5855508787cd
参考资料:
https://azure.github.io/appservice/2016/05/24/deploying-azure-web-app-certifice-through-key-vault.html
我正在Azure中部署一个虚拟机。用户名和密码将自动创建,并在部署时作为参数传递。部署vm的资源组也作为参数传递,所以可以是任何参数。 我的Keyvault在一个特定的资源组中,vm的用户名和密码应该存储在这里。
这个引用目前扼杀了我的整个部署,说: “找不到指定得KeyVault'/subscriptions/[订阅id]/ResourceGroups/[父资源组]/Providers/Microsoft.KeyVault/Vaults/[my KeyVault]'.” 如果删除链接模板中的Keyvault引用,错误就会消失。
我正在构建一个部署web应用程序、sql数据库和密钥库的arm模板。 web应用程序将使用 1-系统标识(将用于访问密钥库)。 webapp需要在keyvault之前部署,因此当部署keyvault时,它可以找到webapp标识,从而为其创建访问策略。 但是这种方法的问题是,当连接字符串作为webapp的一部分添加时,keyvault还不存在,因此@microsoft.keyvault访问秘密的方
我在一个ARM模板中有两个相互依赖的Azure资源:一个密钥库和一个service fabric集群。 是否有一种方法可以引用service fabric集群的对象ID来提供给密钥库的访问策略,是否有一种方法可以在不硬编码任何值的情况下生成密钥库中的机密?理想情况下,我们只知道秘密名称,并且只将该秘密名称提供给ARM模板中的服务fabric集群。
我有一组资源,希望使用Azure Portal中的模板部署特性来部署它们。在我的参数文件中,我很少引用这里提到的键库中的参数。在Azure portal中部署模板(单击Deploy a custom template)并提供这些值时,门户仍然会显式地要求这些参数,而我绝对不能以纯文本形式提供这些参数。