【发布时间】:2021-06-22 13:54:26
【问题描述】:
我正在使用 Azure ARM 模板创建 Azure SQL Server。 “auditingSettings”配置需要通过 Azure 存储帐户(不同的资源组)获得 SQL Server 身份的权限。我正在使用下面的示例代码来授予权限。但是模板部署失败,说明在部署SQL Server的地方找不到Storage账号,确实如此。
那么,我如何链接(引用)存在于“Microsoft.Authorization/roleAssignments”范围下的不同资源组中的存储帐户
模板截图:
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2020-04-01-preview",
"name": "[parameters('roleNameGuid')]",
**"scope": "[concat('Microsoft.Storage/storageAccounts', '/', variables('storageName'))]",**
"dependsOn": [
"[variables('storageName')]"
],
"properties": {
"roleDefinitionId": "[variables(parameters('builtInRoleType'))]",
"principalId": "[parameters('principalId')]"
}
}
错误:
New-AzResourceGroupDeployment : 5:14:22 PM - Resource Microsoft.Authorization/roleAssignments 'cca0ed12-d67c-58cd-a569-e265bc2d5806' failed with message '{
"error": {
"code": "ResourceNotFound",
"message": "The Resource 'Microsoft.Storage/storageAccounts/commonsdev' under resource group 'apis-dev' was not found. For more details please go to
https://aka.ms/ARMResourceNotFoundFix"
}
}'
At line:1 char:1
+ New-AzResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzResourceGroupDeployment : 5:20:00 PM - Resource Microsoft.Sql/servers/auditingSettings 'apis-sqlserver-dev/Default' failed with message '{
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "BlobAuditingInsufficientStorageAccountPermissions",
"message": "Insufficient read or write permissions on storage account 'commonsdev'. Add permissions to the server Identity to the storage account."
}
]
【问题讨论】:
标签: azure-storage azure-resource-manager azure-rbac