Skip to content

Commit 983ac27

Browse files
authored
Added info about treatFailureAsDeploymentFailure in API 2023-03-01
Updated the rest API example and API version to latest.
1 parent 7c9623f commit 983ac27

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

articles/virtual-machines/windows/run-command-managed.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Remove-AzVMRunCommand -ResourceGroupName "myRG" -VMName "myVM" -RunCommandName "
210210
To deploy a new Run Command, execute a PUT on the VM directly and specify a unique name for the Run Command instance.
211211

212212
```rest
213-
PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands/<runCommandName>?api-version=2019-12-01
213+
PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands/<runCommandName>?api-version=2023-03-01
214214
```
215215

216216
```json
@@ -244,7 +244,8 @@ PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers
244244
],
245245
"runAsUser": "userName",
246246
"runAsPassword": "userPassword",
247-
"timeoutInSeconds": 3600,
247+
"timeoutInSeconds": 3600,
248+
"treatFailureAsDeploymentFailure": true,
248249
"outputBlobUri": "< SAS URI of a storage append blob with read, add, create, write access>",
249250
"errorBlobUri": "< SAS URI of a storage append blob with read, add, create, write access >"
250251
}
@@ -254,28 +255,29 @@ PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers
254255
### Notes
255256

256257
- You can provide an inline script, a script URI, or a built-in script [command ID](run-command.md#available-commands) as the input source. Script URI is either storage blob SAS URI with read access or public URI.
257-
- Only one type of source input is supported for one command execution.
258+
- Only one type of source input is supported for one command execution.
259+
- Starting with API version 2023-03-01, you can set the property `treatFailureAsDeploymentFailure` to **true** causing the deployment to fail when there is a failure in the script. If set to **false**, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures.
258260
- Run Command supports writing output and error to Storage blobs using outputBlobUri and errorBlobUri parameters, which can be used to store large script outputs. Use SAS URI of a storage append blob with read, add, create, write access. The blob should be of type AppendBlob. Writing the script output or error blob would fail otherwise. The blob will be overwritten if it already exists. It will be created if it does not exist.
259261

260262

261263
### List running instances of Run Command on a VM
262264

263265
```rest
264-
GET /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands?api-version=2019-12-01
266+
GET /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands?api-version=2023-03-01
265267
```
266268

267269
### Get output details for a specific Run Command deployment
268270

269271
```rest
270-
GET /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands/<runCommandName>?$expand=instanceView&api-version=2019-12-01
272+
GET /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands/<runCommandName>?$expand=instanceView&api-version=2023-03-01
271273
```
272274

273275
### Delete a specific Run Command deployment
274276

275277
You can also delete the instance of Run Command.
276278

277279
```rest
278-
DELETE /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands/<runCommandName>?api-version=2019-12-01
280+
DELETE /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands/<runCommandName>?api-version=2023-03-01
279281
```
280282

281283
### Deploy scripts in an ordered sequence
@@ -312,7 +314,7 @@ In this example, **secondRunCommand** will execute after **firstRunCommand**.
312314
{
313315
"type":"Microsoft.Compute/virtualMachines/runCommands",
314316
"name":"[concat(parameters('vmName'),'/firstRunCommand')]",
315-
"apiVersion":"2019-12-01",
317+
"apiVersion":"2023-03-01",
316318
"location":"[parameters('location')]",
317319
"dependsOn":[
318320
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"

0 commit comments

Comments
 (0)