Hi @Brian D H ZHANG,
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Issue: Is there a PowerShell statement that can Update a server with User Managed Identies? the az cli cann't work in my env. I need to use powershell.
Solution:
As you stated that, you have resolved the issue using azure CLI.
The solution is as follows.
- The following command clears the UMI.
az sql server update -g resourceGroupName -n serverName -i --user-assigned-identity-id /subscriptions/xxxxxxxxxxxxx/resourceGroups/xxxxxxxxxx/providers/Microsoft.ManagedIdentity/userAssignedIdentities/xxxxxxxxx
2.set sql server UMI
az sql server update -g resourceGroupName -n serverName -i --user-assigned-identity-id /subscriptions/xxxxxxxxxxxxx/resourceGroups/xxxxxxxxxx/providers/Microsoft.ManagedIdentity/userAssignedIdentities/xxxxxxxxx
--identity-type UserAssigned --pid /subscriptions/xxxxxxxxxxxxx/resourceGroups/xxxxxxxxxx/providers/Microsoft.ManagedIdentity/userAssignedIdentities/xxxxxxxxx
3.set database UMI
az sql db update -g resourceGroupName -s serverName
-n databaseName -i --user-assigned-identity-id
/subscriptions/xxxxxxxxxxxxx/resourceGroups/xxxxxxxxxx/providers/Microsoft.ManagedIdentity/userAssignedIdentities/xxxxxxxxx
If I missed anything please let me know and I'd be happy to add it to answer, or feel free to comment below with any additional information.
Please remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution.
Thank you,