Forum Discussion
sag007
May 06, 2022Copper Contributor
Execute script on Azure Windows VM via Azure pipeline
I am using third party software for master data management. This software does not have API's to perform deployment across environment. It has command line utility which needs to be installed on mach...
nguyenphupn
Dec 09, 2022Copper Contributor
Hi sag007 ,
You can use AzureCLI in the pipeline to run the command:
- task: AzureCLI@2
inputs:
azureSubscription: 'YourSubscription'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az vm run-command invoke --command-id RunPowerShellScript --name your-vm-name -g resource-group-name --scripts C:\Script\yourscript.ps1
"C:\Script\yourscript.ps1" is the path of your script in the VM, if you want to run others command, you only need to change it. Example: "--scripts Get-Process".
To verify executed script. Go to VM and check in this path: C:\Packages\Plugins\Microsoft.CPlat.Core.RunCommandWindows\1.1.15\Downloads![]()