I want to know about Run Command Rest API that help to execute script on VM

Marrium Aziz Khan 1 Reputation point
2021-04-07T07:37:42.113+00:00

I m calling Rest API inside my function app to place file on VM from Storage account but I am not able to link path of file in script, I am calling rest api mention here: https://learn.microsoft.com/en-us/rest/api/compute/virtual%20machines%20run%20commands/runcommand

Whats Required:
Need to place file from storage account to VM (Windows and Centos Both VM's)

Troubleshooting and labs already done:

We did it before simply calling Invoke-AzRunCommand although we testes one file per time

Issue with Invoke_AzRunCommand: This command has some limitation and we cant upload in bulk (error on Invoke command "run command extension execution is in progress. please wait for completion before invoking a run command.)

![85213-image.png][1]

What I found next :

Rest API : https://learn.microsoft.com/en-us/rest/api/compute/virtual%20machines%20run%20commands/runcommand

Now I am trying to do it by using Rest API but I am getting 400/ 404 error that means bad request (may be my body is not accurate)

I need help to find out, how can we define script with Rest API Json Body, as I have 20+ lines of script save at root folder of my app.

OR if i use Invoke-AzRunCommand, how can I use it in case of bulk of files

Azure Stack Hub
Azure Stack Hub
An extension of Azure for running apps in an on-premises environment and delivering Azure services in a datacenter.
179 questions
{count} votes