Skip to content

Commit 144e30a

Browse files
Merge pull request #211251 from ericd-mst-github/erd-run-command-windows
Run Command changes to cmdlet, rest API, and notes
2 parents 4c0620a + 1b3b728 commit 144e30a

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

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

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,19 @@ az vm run-command delete --name "myRunCommand" --vm-name "myVM" --resource-group
7474
### Execute a script with the VM
7575
This command will deliver the script to the VM, execute it, and return the captured output.
7676

77+
7778
```azurepowershell-interactive
7879
Set-AzVMRunCommand -ResourceGroupName "myRG" -VMName "myVM" -Location "EastUS" -RunCommandName "RunCommandName" –SourceScript "echo Hello World!"
7980
```
8081

82+
### Execute a script on the VM using SourceScriptUri parameter
83+
`OutputBlobUri` and `ErrorBlobUri` are optional parameters.
84+
85+
```azurepowershell-interactive
86+
Set-AzVMRunCommand -ResourceGroupName -VMName -RunCommandName -SourceScriptUri “< SAS URI of a storage blob with read access or public URI>" -OutputBlobUri “< SAS URI of a storage append blob with read, add, create, write access>” -ErrorBlobUri “< SAS URI of a storage append blob with read, add, create, write access>”
87+
```
88+
89+
8190
### List all deployed RunCommand resources on a VM
8291
This command will return a full list of previously deployed Run Commands along with their properties.
8392

@@ -104,16 +113,16 @@ Remove-AzVMRunCommand -ResourceGroupName "myRG" -VMName "myVM" -RunCommandName "
104113
To deploy a new Run Command, execute a PUT on the VM directly and specify a unique name for the Run Command instance.
105114

106115
```rest
107-
PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands/<runCommandName>?api-version=2019-12-01
116+
GET /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands?api-version=2019-12-01
108117
```
109118

110119
```json
111120
{
112121
"location": "<location>",
113122
"properties": {
114123
"source": {
115-
"script": "echo Hello World",
116-
"scriptUri": "<URI>",
124+
"script": "Write-Host Hello World!",
125+
"scriptUri": "<SAS URI of a storage blob with read access or public URI>",
117126
"commandId": "<Id>"
118127
},
119128
"parameters": [
@@ -139,25 +148,27 @@ PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers
139148
"runAsUser": "userName",
140149
"runAsPassword": "userPassword",
141150
"timeoutInSeconds": 3600,
142-
"outputBlobUri": "<URI>",
143-
"errorBlobUri": "<URI>"
151+
"outputBlobUri": "< SAS URI of a storage append blob with read, add, create, write access>",
152+
"errorBlobUri": "< SAS URI of a storage append blob with read, add, create, write access >"
144153
}
145154
}
146155
```
147156

148157
### Notes
149158

150-
- 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
151-
- Only one type of source input is supported for one command execution
152-
- Run Command supports output to Storage blobs, which can be used to store large script outputs
153-
- Run Command supports error output to Storage blobs
159+
- 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.
160+
- Only one type of source input is supported for one command execution.
161+
- 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.
162+
154163

155164
### List running instances of Run Command on a VM
156165

157166
```rest
158167
GET /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands?api-version=2019-12-01
159168
```
160169

170+
171+
161172
### Get output details for a specific Run Command deployment
162173

163174
```rest
@@ -240,7 +251,7 @@ In this example, **secondRunCommand** will execute after **firstRunCommand**.
240251
],
241252
"properties":{
242253
"source":{
243-
"scriptUrl":"http://github.com/myscript.ps1"
254+
"scriptUri":"http://github.com/myscript.ps1"
244255
},
245256
"timeoutInSeconds":60
246257
}

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,15 @@ az vm run-command delete --name "myRunCommand" --vm-name "myVM" --resource-group
7575
This command will deliver the script to the VM, execute it, and return the captured output.
7676

7777
```powershell-interactive
78-
Set-AzVMRunCommand -ResourceGroupName "myRG" -VMName "myVM" -RunCommandName "RunCommandName" –SourceScript "Write-Host Hello World!"
78+
Set-AzVMRunCommand -ResourceGroupName "myRG" -VMName "myVM" -Location "EastUS" -RunCommandName "RunCommandName" –SourceScript "echo Hello World!"
7979
```
80+
### Execute a script on the VM using SourceScriptUri parameter
81+
`OutputBlobUri` and `ErrorBlobUri` are optional parameters.
82+
83+
```powershell-interactive
84+
Set-AzVMRunCommand -ResourceGroupName -VMName -RunCommandName -SourceScriptUri “< SAS URI of a storage blob with read access or public URI>" -OutputBlobUri “< SAS URI of a storage append blob with read, add, create, write access>” -ErrorBlobUri “< SAS URI of a storage append blob with read, add, create, write access>”
85+
```
86+
8087

8188
### List all deployed RunCommand resources on a VM
8289
This command will return a full list of previously deployed Run Commands along with their properties.
@@ -114,7 +121,7 @@ PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers
114121
"properties": {
115122
"source": {
116123
"script": "Write-Host Hello World!",
117-
"scriptUri": "<URI>",
124+
"scriptUri": "<SAS URI of a storage blob with read access or public URI>",
118125
"commandId": "<Id>"
119126
},
120127
"parameters": [
@@ -140,18 +147,17 @@ PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers
140147
"runAsUser": "userName",
141148
"runAsPassword": "userPassword",
142149
"timeoutInSeconds": 3600,
143-
"outputBlobUri": "<URI>",
144-
"errorBlobUri": "<URI>"
150+
"outputBlobUri": "< SAS URI of a storage append blob with read, add, create, write access>",
151+
"errorBlobUri": "< SAS URI of a storage append blob with read, add, create, write access >"
145152
}
146153
}
147154
```
148155

149156
### Notes
150157

151-
- 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
152-
- Only one type of source input is supported for one command execution
153-
- Run Command supports output to Storage blobs, which can be used to store large script outputs
154-
- Run Command supports error output to Storage blobs
158+
- 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.
159+
- Only one type of source input is supported for one command execution.
160+
- 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.
155161

156162

157163
### List running instances of Run Command on a VM
@@ -242,7 +248,7 @@ In this example, **secondRunCommand** will execute after **firstRunCommand**.
242248
],
243249
"properties":{
244250
"source":{
245-
"scriptUrl":"http://github.com/myscript.ps1"
251+
"scriptUri":"http://github.com/myscript.ps1"
246252
},
247253
"timeoutInSeconds":60
248254
}

0 commit comments

Comments
 (0)