azure-powershell
azure-powershell copied to clipboard
Cannot use Invoke-AzVmssVMRunCommand with a Flexible Scale Set
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
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?
ack, Looking in to it.
@GabstaMSFT , This is a powershell client issue. This should go to Powershell team
I tested REST API equivalent of Set-AzVmssVMRunCommand (Managed Run Command). The backend API does receive the request and process it successfully.
@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
Using PowerShell Set-AzVmssVmRunCommand, the request looks identical to the direct API call @vivlingaiah made above. I am going to create an ICM
@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
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