Skip to content

Commit 9e760d7

Browse files
Additional edits.
1 parent e0c8c77 commit 9e760d7

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

articles/virtual-machines/extensions/custom-script-linux.md

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ To download a script externally, such as from GitHub or Azure Storage, you need
4141

4242
If your script is on a local server, you might still need to open other firewall or NSG ports.
4343

44-
### Tips and tricks
44+
### Tips
4545

4646
- The highest failure rate for this extension is due to syntax errors in the script. Verify that the script runs without errors. Put more logging into the script to make it easier to find failures.
4747
- Write scripts that are idempotent, so that running them more than once accidentally doesn't cause system changes.
@@ -103,32 +103,32 @@ You can store sensitive data in a protected configuration, which is encrypted an
103103

104104
| Name | Value or example | Data type |
105105
| ---- | ---- | ---- |
106-
| `apiVersion` | `2019-03-01` | date |
107-
| `publisher` | `Microsoft.Azure.Extensions` | string |
108-
| `type` | `CustomScript` | string |
109-
| `typeHandlerVersion` | `2.1` | int |
110-
| `fileUris` | `https://github.com/MyProject/Archive/MyPythonScript.py` | array |
111-
| `commandToExecute` | `python MyPythonScript.py \<my-param1>` | string |
112-
| `script` | `IyEvYmluL3NoCmVjaG8gIlVwZGF0aW5nIHBhY2thZ2VzIC4uLiIKYXB0IHVwZGF0ZQphcHQgdXBncmFkZSAteQo=` | string |
113-
| `skipDos2Unix` | `false` | boolean |
114-
| `timestamp` | `123456789` | 32-bit integer |
115-
| `storageAccountName` | `examplestorageacct` | string |
116-
| `storageAccountKey` | `TmJK/1N3AbAZ3q/+hOXoi/l73zOqsaxXDhqa9Y83/v5UpXQp2DQIBuv2Tifp60cE/OaHsJZmQZ7teQfczQj8hg==` | string |
117-
| `managedIdentity` | `{ }` or `{ "clientId": "31b403aa-c364-4240-a7ff-d85fb6cd7232" }` or `{ "objectId": "12dd289c-0583-46e5-b9b4-115d5c19ef4b" }` | JSON object |
106+
| apiVersion | `2019-03-01` | date |
107+
| publisher | `Microsoft.Azure.Extensions` | string |
108+
| type | `CustomScript` | string |
109+
| typeHandlerVersion | `2.1` | int |
110+
| fileUris | `https://github.com/MyProject/Archive/MyPythonScript.py` | array |
111+
| commandToExecute | `python MyPythonScript.py \<my-param1>` | string |
112+
| script | `IyEvYmluL3NoCmVjaG8gIlVwZGF0aW5nIHBhY2thZ2VzIC4uLiIKYXB0IHVwZGF0ZQphcHQgdXBncmFkZSAteQo=` | string |
113+
| skipDos2Unix | `false` | boolean |
114+
| timestamp | `123456789` | 32-bit integer |
115+
| storageAccountName | `examplestorageacct` | string |
116+
| storageAccountKey | `TmJK/1N3AbAZ3q/+hOXoi/l73zOqsaxXDhqa9Y83/v5UpXQp2DQIBuv2Tifp60cE/OaHsJZmQZ7teQfczQj8hg==` | string |
117+
| managedIdentity | `{ }` or `{ "clientId": "31b403aa-c364-4240-a7ff-d85fb6cd7232" }` or `{ "objectId": "12dd289c-0583-46e5-b9b4-115d5c19ef4b" }` | JSON object |
118118

119119
### Property value details
120120

121121
| Property | Optional or required | Details |
122122
| ---- | ---- | ---- |
123-
| `apiVersion` | Not applicable | You can find the most up-to-date API version by using [Resource Explorer](https://resources.azure.com/) or by using the command `az provider list -o json` in the Azure CLI. |
124-
| `fileUris` | Optional | URLs for files to be downloaded. |
125-
| `commandToExecute` | Required if `script` isn't set | The entry point script to run. Use this property instead of `script` if your command contains secrets such as passwords. |
126-
| `script` | Required if `commandToExecute` isn't set | A Base64-encoded and optionally gzip'ed script run by `/bin/sh`. |
127-
| `skipDos2Unix` | Optional | Set this value to `false` if you want to skip dos2unix conversion of script-based file URLs or scripts. |
128-
| `timestamp` | Optional | Change this value only to trigger a rerun of the script. Any integer value is acceptable, as long as it's different from the previous value. |
129-
| `storageAccountName` | Optional | The name of storage account. If you specify storage credentials, all `fileUris` values must be URLs for Azure blobs. |
130-
| `storageAccountKey` | Optional | The access key of the storage account. |
131-
| `managedIdentity` | Optional | The [managed identity](../../active-directory/managed-identities-azure-resources/overview.md) for downloading files. Values are `clientId` (optional, string), which is the client ID of the managed identity, and `objectId` (optional, string), which is the object ID of the managed identity.|
123+
| apiVersion | Not applicable | You can find the most up-to-date API version by using [Resource Explorer](https://resources.azure.com/) or by using the command `az provider list -o json` in the Azure CLI. |
124+
| fileUris | Optional | URLs for files to be downloaded. |
125+
| commandToExecute | Required if `script` isn't set | The entry point script to run. Use this property instead of `script` if your command contains secrets such as passwords. |
126+
| script | Required if `commandToExecute` isn't set | A Base64-encoded and optionally gzip'ed script run by `/bin/sh`. |
127+
| skipDos2Unix | Optional | Set this value to `false` if you want to skip dos2unix conversion of script-based file URLs or scripts. |
128+
| timestamp | Optional | Change this value only to trigger a rerun of the script. Any integer value is acceptable, as long as it's different from the previous value. |
129+
| storageAccountName | Optional | The name of storage account. If you specify storage credentials, all `fileUris` values must be URLs for Azure blobs. |
130+
| storageAccountKey | Optional | The access key of the storage account. |
131+
| managedIdentity | Optional | The [managed identity](../../active-directory/managed-identities-azure-resources/overview.md) for downloading files. Values are `clientId` (optional, string), which is the client ID of the managed identity, and `objectId` (optional, string), which is the object ID of the managed identity.|
132132

133133
*Public settings* are sent in clear text to the VM where the script runs. *Protected settings* are encrypted through a key known only to Azure and the VM. The settings are saved to the VM as they were sent. That is, if the settings were encrypted, they're saved encrypted on the VM. The certificate that's used to decrypt the encrypted values is stored on the VM. The certificate is also used to decrypt settings, if necessary, at runtime.
134134

@@ -375,35 +375,35 @@ Use a protected configuration file to specify the command to be run:
375375

376376
1. Create the public configuration file by using the text editor of your choice or by using the following CLI command:
377377

378-
```azurecli
379-
cat <<EOF > script-config.json
380-
{
381-
"fileUris": ["https://raw.githubusercontent.com/Microsoft/dotnet-core-sample-templates/master/dotnet-core-music-linux/scripts/config-music.sh"]
382-
}
383-
EOF
384-
```
378+
```azurecli
379+
cat <<EOF > script-config.json
380+
{
381+
"fileUris": ["https://raw.githubusercontent.com/Microsoft/dotnet-core-sample-templates/master/dotnet-core-music-linux/scripts/config-music.sh"]
382+
}
383+
EOF
384+
```
385385

386386
1. Create the protected configuration file by using the text editor of your choice or by using the following CLI command:
387387

388-
```azurecli
389-
cat <<EOF > protected-config.json
390-
{
391-
"commandToExecute": "./config-music.sh"
392-
}
393-
EOF
394-
```
388+
```azurecli
389+
cat <<EOF > protected-config.json
390+
{
391+
"commandToExecute": "./config-music.sh"
392+
}
393+
EOF
394+
```
395395

396396
1. Run the following command:
397397

398-
```azurecli
399-
az vm extension set \
400-
--resource-group myResourceGroup \
401-
--vm-name myVM \
402-
--name customScript \
403-
--publisher Microsoft.Azure.Extensions \
404-
--settings ./script-config.json \
405-
--protected-settings ./protected-config.json
406-
```
398+
```azurecli
399+
az vm extension set \
400+
--resource-group myResourceGroup \
401+
--vm-name myVM \
402+
--name customScript \
403+
--publisher Microsoft.Azure.Extensions \
404+
--settings ./script-config.json \
405+
--protected-settings ./protected-config.json
406+
```
407407

408408
## Virtual Machine Scale Sets
409409

@@ -538,4 +538,4 @@ The output looks like the following text:
538538

539539
## Next steps
540540

541-
To see the code, current issues, and versions, go to the [custom-script-extension-linux repo on GitHub](https://github.com/Azure/custom-script-extension-linux).
541+
To see the code, current issues, and versions, see [custom-script-extension-linux](https://github.com/Azure/custom-script-extension-linux).

0 commit comments

Comments
 (0)