SOLVED

Managed Service Identity causes problems resizing VM

Copper Contributor

The VM will not resize from the Azure portal with an error:

 
Error: The principalId 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx' on the resource's Identity property must be null or empty for 'SystemAssigned' identity type
 
I have deleted the ServicePrincipal from AzureAD
I have disabled MSI on the VM
I have redeployed the VM
 
None of these was sufficient.
Any advice as MS EA support seems to not respond despite having a 1 hour target it's been almost 24 hours and no reply.
8 Replies
Check and see if you have any extensions associated with the VM
No other extensions, once I removed the MSI extension. So no joy there. Thanks for the reply.
Have you tried a different VM size for the resize? It could be down to the cluster your VM is sitting on might not support the size your trying to go to.

You could also try powershell. It might work.
Yes, I've tried all those!

I've now made a custom image from a snapshot and then I'll build a new VM of the correct size.

I am annoyed that EA support never even replied to my support request, which is why I posted here.

I still want to know how to fix this issue, as we resize our VMs often and if MSI interferes with resizing, then no automation for me.
When you get an answer please update here. Would be good to see what the issue is.
best response confirmed by Chris O'Donoghue (Copper Contributor)
Solution

I was able to get around this problem with PowerShell. Not sure why this works, but maybe it'll help. The issue seems to be that MSI is leaving an Identity property on the VM. I set this property to $null and set the new size of the VM in the same update:

> $vm = Get-AzureRmVM -ResourceGroupName [VALUE] -Name [VALUE]
> $vm.Identity = $null
> $vm.HardwareProfile.VmSize = [DESIRED SIZE]
> Update-AzureRmVM -ResourceGroupName [VALUE] -VM $vm

DESIRED SIZE is the string representation of size like 'Standard_D4s_v3'.

This did not erase the Identity property, but did set the size successfully. 

I hate so much that this is still an issue. So dumb.
1 best response

Accepted Solutions
best response confirmed by Chris O'Donoghue (Copper Contributor)
Solution

I was able to get around this problem with PowerShell. Not sure why this works, but maybe it'll help. The issue seems to be that MSI is leaving an Identity property on the VM. I set this property to $null and set the new size of the VM in the same update:

> $vm = Get-AzureRmVM -ResourceGroupName [VALUE] -Name [VALUE]
> $vm.Identity = $null
> $vm.HardwareProfile.VmSize = [DESIRED SIZE]
> Update-AzureRmVM -ResourceGroupName [VALUE] -VM $vm

DESIRED SIZE is the string representation of size like 'Standard_D4s_v3'.

This did not erase the Identity property, but did set the size successfully. 

View solution in original post