azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Cannot use Invoke-AzVmssVMRunCommand with a Flexible Scale Set

Open mike-westaway opened this issue 1 year ago • 4 comments

Type of issue

Missing information

Feedback

For a flexible scale set the InstanceId is the name of the VM [https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-instance-ids#scale-set-instance-id-for-flexible-orchestration-mode] Although the -InstanceId parameter for Invoke-AzVmssVMRunCommand accepts a string, if you try and use it with a Flexible scale set you get an error: Invoke-AzVmssVMRunCommand: Virtual Machine Scale Set VM instanceId must be a number. ErrorCode: InvalidParameter ErrorMessage: Virtual Machine Scale Set VM instanceId must be a number. ErrorTarget: instanceId StatusCode: 400

If it shoudl work then fix the implementation to accept a VM name for Flexible If it is not internded to work with Flexible then document and suggest an alternative.

Page URL

https://learn.microsoft.com/en-us/powershell/module/az.compute/invoke-azvmssvmruncommand?view=azps-11.0.0

Content source URL

https://github.com/Azure/azure-powershell/blob/main/src/Compute/Compute/help/Invoke-AzVmssVMRunCommand.md

Author

@mikefrobbins

Document Id

16f559e8-ad99-fa0f-4ea6-b472099a4317

mike-westaway avatar Nov 30 '23 10:11 mike-westaway

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @TravisCragg-MSFT, @sandeepraichura.

@nikhilpatel909, could you look at this issue to see if it is a bug in the implementation or a problem in the documentation?

Drewm3 avatar Dec 04 '23 17:12 Drewm3

ack, Looking in to it.

nikhilpatel909 avatar Dec 04 '23 18:12 nikhilpatel909

@GabstaMSFT , This is a powershell client issue. This should go to Powershell team

image image

I tested REST API equivalent of Set-AzVmssVMRunCommand (Managed Run Command). The backend API does receive the request and process it successfully.

image

@mike-westaway ,

Until the cmdlets Invoke-AzVmssVMRunCommand and Set-AzVmssVmRunCommand are fixed, please use a workaround of issuing requests using REST API directly. PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}?api-version=2024-03-01

vivlingaiah avatar Apr 19 '24 23:04 vivlingaiah

Using PowerShell Set-AzVmssVmRunCommand, the request looks identical to the direct API call @vivlingaiah made above. I am going to create an ICM

grizzlytheodore avatar Aug 15 '24 20:08 grizzlytheodore

@mike-westaway @vivlingaiah
From the ICM, the RunCommand team directed for VMSS VMs in Flexible mode, use Set-AzVMRunCommand/Invoke-AzVmRunCommand.

And I was able to verify this working.

I will work with the RunCommand team to update the documentation to have this information or update the service side logics to have Set-AzVmssVmRunCommand work with flex mode as well

grizzlytheodore avatar Aug 21 '24 16:08 grizzlytheodore

RunCommand team is working on fixing Set-AzVmssVmRunCommand to work with VMSS Flex mode VMs. I will close this issue as a temporary solution has been provided. Please ping us if further support is needed

grizzlytheodore avatar Aug 26 '24 15:08 grizzlytheodore