You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### 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
+
81
90
### List all deployed RunCommand resources on a VM
82
91
This command will return a full list of previously deployed Run Commands along with their properties.
To deploy a new Run Command, execute a PUT on the VM directly and specify a unique name for the Run Command instance.
105
114
106
115
```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
108
117
```
109
118
110
119
```json
111
120
{
112
121
"location": "<location>",
113
122
"properties": {
114
123
"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>",
117
126
"commandId": "<Id>"
118
127
},
119
128
"parameters": [
@@ -139,25 +148,27 @@ PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers
139
148
"runAsUser": "userName",
140
149
"runAsPassword": "userPassword",
141
150
"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 >"
144
153
}
145
154
}
146
155
```
147
156
148
157
### Notes
149
158
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
+
154
163
155
164
### List running instances of Run Command on a VM
156
165
157
166
```rest
158
167
GET /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands?api-version=2019-12-01
159
168
```
160
169
170
+
171
+
161
172
### Get output details for a specific Run Command deployment
162
173
163
174
```rest
@@ -240,7 +251,7 @@ In this example, **secondRunCommand** will execute after **firstRunCommand**.
### 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
+
80
87
81
88
### List all deployed RunCommand resources on a VM
82
89
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
114
121
"properties": {
115
122
"source": {
116
123
"script": "Write-Host Hello World!",
117
-
"scriptUri": "<URI>",
124
+
"scriptUri": "<SAS URI of a storage blob with read access or public URI>",
118
125
"commandId": "<Id>"
119
126
},
120
127
"parameters": [
@@ -140,18 +147,17 @@ PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers
140
147
"runAsUser": "userName",
141
148
"runAsPassword": "userPassword",
142
149
"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 >"
145
152
}
146
153
}
147
154
```
148
155
149
156
### Notes
150
157
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.
155
161
156
162
157
163
### List running instances of Run Command on a VM
@@ -242,7 +248,7 @@ In this example, **secondRunCommand** will execute after **firstRunCommand**.
0 commit comments