英文:
How to add user assigned identity in azure sql using azure cli?
问题
使用Azure CLI执行以下功能。关闭系统分配的服务主体,添加用户托管标识,并将其设置为主要标识。非常感谢帮助。
参考链接:https://learn.microsoft.com/en-us/azure/azure-sql/database/authentication-azure-ad-user-assigned-managed-identity?view=azuresql#set-a-managed-identity-in-the-azure-portal
英文:
I want to do the following function using Azure CLI. turn the system assigned service principal off, Add a user managed identity and make it the primary identity using Azure CLI. Would much appreciate the help.
答案1
得分: 0
az sql mi update -g Analytics-Resources -n sqlmanagedinstanceshared -i --user-assigned-identity-id /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Analytics-Resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dbm --identity-type UserAssigned --pid /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Analytics-Resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dbm
我尝试使用以下代码在我的环境中复制这个问题:
我遇到了相同的错误:
这个错误是因为在 -i 后面多了一个额外的反斜杠,我去掉它后尝试执行了这段代码:
错误已经解决,成功执行了。
英文:
I tried to replicate the issue in my environment with below code:
az sql mi update -g Analytics-Resources -n sqlmanagedinstanceshared -i \ --user-assigned-identity-id /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Analytics-Resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dbm \ --identity-type UserAssigned --pid /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Analytics-Resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dbm
I got the same error:
This error I got because of extra back slash at -i I removed that tried to exucute the code:
az sql mi update -g Analytics-Resources -n sqlmanagedinstanceshared -i --user-assigned-identity-id /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Analytics-Resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dbm \ --identity-type UserAssigned --pid /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Analytics-Resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dbm
The error was resolved, and it executed successfully.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论