我尝试在 Azure DevOps 上使用 ARM 创建 SQL Server。管道成功地为 Azure 门户创建了 SQL Server 资源,但我在 Azure DevOps 中遇到了奇怪的错误。为什么会发生这种情况以及如何解决?
错误:
There were errors in your deployment. Error code: DeploymentFailed.
##[error]RoleAssignmentUpdateNotPermitted: Tenant ID, application ID, principal ID, and scope are not
allowed to be updated.
##[error]Check out the troubleshooting guide to see if your issue is addressed:
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?
view=azure-devops#troubleshooting
##[error]Task failed while creating or updating the template deployment.
Run Code Online (Sandbox Code Playgroud)
YML:
task: AzureResourceManagerTemplateDeployment@3
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: 'TestRG-Conn'
subscriptionId: '1111753a-501e-4e46-9aff-6120ed561111'
action: 'Create Or Update Resource Group'
resourceGroupName: 'TestRG'
location: 'North Europe'
templateLocation: 'Linked artifact'
csmFile: '$(System.DefaultWorkingDirectory)/CreateSQLServer/azuredeploy.json'
csmParametersFile:
'$(System.DefaultWorkingDirectory)/CreateSQLServer/azuredeploy.parameters.json'
deploymentMode: 'Incremental'
Run Code Online (Sandbox Code Playgroud)
模板中的变量:
"variables": {
"StorageBlobContributor": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '111111111111111111111-')]"
Run Code Online (Sandbox Code Playgroud)
},
模板资源:
"resources": [
{
"condition": "[parameters('enableADS')]",
"type":
"Microsoft.Storage/storageAccounts/providers/roleAssignments",
"apiVersion": "2018-09-01-preview",
"name": "[concat(variables('storageName'),
'/Microsoft.Authorization/', variables('uniqueRoleGuid') )]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers',
parameters('serverName'))]",
"[resourceId('Microsoft.Storage/storageAccounts',
variables('storageName'))]"
],
"properties": {
"roleDefinitionId": "[variables('StorageBlobContributor')]",
"principalId": "[reference(resourceId('Microsoft.Sql/servers',
parameters('serverName')), '2018-06-01-preview',
'Full').identity.principalId]",
"scope": "[resourceId('Microsoft.Storage/storageAccounts',
variables('storageName'))]",
"principalType": "ServicePrincipal"
}
}
Run Code Online (Sandbox Code Playgroud)
ber*_*zns 10
就我而言,它是 RoleAssignment 的名称。它在资源组级别上是唯一的,但在订阅级别上不是唯一的。不确定名称唯一性的范围是什么。
小智 7
您可能已经部署并删除了资源,但是,角色分配仍然存在,这就是它与之冲突的地方(4c7 ... 所说的内容)。因此,请检查存储帐户的权限 - 如果您使用托管身份,该身份将被删除,但角色分配将持续存在并将用户显示为“未知”,这也会在尝试再次部署时导致上述错误 - 有同样的问题,但我使用的是用于 aks 集群的托管身份。令人沮丧。
当您删除托管标识时,它不会删除为其创建的关联角色,我希望它被正确清理。
| 归档时间: |
|
| 查看次数: |
2364 次 |
| 最近记录: |