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
Copy file name to clipboardExpand all lines: articles/virtual-machines/extensions/custom-script-linux.md
+52-9Lines changed: 52 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ ms.date: 03/29/2023
12
12
---
13
13
# Use the Azure Custom Script Extension Version 2 with Linux virtual machines
14
14
15
-
The Custom Script Extension Version 2 downloads and runs scripts on Azure virtual machines (VMs). Use this for post-deployment configuration, software installation, or any other configuration or management task. You can download scripts from Azure Storage or another accessible internet location, or you can provide them to the extension runtime.
15
+
The Custom Script Extension Version 2 downloads and runs scripts on Azure virtual machines (VMs). Use this extension for post-deployment configuration, software installation, or any other configuration or management task. You can download scripts from Azure Storage or another accessible internet location, or you can provide them to the extension runtime.
16
16
17
17
The Custom Script Extension integrates with Azure Resource Manager templates. You can also run it by using the Azure CLI, PowerShell, or the Azure Virtual Machines REST API.
18
18
@@ -305,14 +305,27 @@ az vm extension set \
305
305
306
306
### Example: Public configuration with script file
307
307
308
+
This example uses the following script file named *script-config.json*:
1. Create the protected configuration file by using the text editor of your choice or by using the following CLI command:
397
+
398
+
```azurecli
399
+
cat <<EOF > protected-config.json
400
+
{
401
+
"commandToExecute": "./config-music.sh <param1>"
402
+
}
403
+
EOF
404
+
```
405
+
406
+
1. Run the following command:
364
407
365
408
```azurecli
366
409
az vm extension set \
@@ -374,7 +417,7 @@ az vm extension set \
374
417
375
418
## Virtual Machine Scale Sets
376
419
377
-
If you deploy the Custom Script Extension from the Azure portal, you don't have control over the expiration of the SAS token to access the script in your storage account. The result is that the initial deployment works, but when the storage account's SAS token expires, any subsequent scaling operation fails because the Custom Script Extension can no longer access the storage account.
420
+
If you deploy the Custom Script Extension from the Azure portal, you don't have control over the expiration of the SAS token to access the script in your storage account. The initial deployment works, but when the storage account's SAS token expires, any subsequent scaling operation fails because the Custom Script Extension can no longer access the storage account.
378
421
379
422
We recommend that you use [PowerShell](/powershell/module/az.Compute/Add-azVmssExtension), the [Azure CLI](/cli/azure/vmss/extension), or an [Azure Resource Manager template](/azure/templates/microsoft.compute/virtualmachinescalesets/extensions) when you deploy the Custom Script Extension on a Virtual Machine Scale Set. This way, you can choose to use a managed identity or have direct control of the expiration of the SAS token for accessing the script in your storage account for as long as you need.
0 commit comments