I am sending api request using python requests library.
The code as follows;
subscription_id =os.environ['AZURE_SUBSCRIPTION_ID']
source="https://management.azure.com"
token_context=access_token()
tokens=json.loads(token_context.text)
token=tokens['access_token']
headers = {'Authorization': 'Bearer ' +token,
'Content-Type': 'application/json'}
data={
"commandId": "RunShellScript",
"script":["urlAdresstoScriptStoredinBlobStorage"]}
api="{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/runCommand?api-version=2021-11-01".format(
source,subscription_id,vmRG,vmName)
response = requests.post(api,json=data,headers=headers)
return response
The Error I got:
"error": {
"code": "Conflict",
"message": "Run command OS type 'Linux' does not match the target OS Windows."
}
What could be the source of the error and how to solve it?
Any suggestion is appreciated, Thanks.