Table of Contents
Extensions can help with:
To deploy VM extensions through the Azure Portal:
For PowerShell, the cmdlet Set-AzVMExtension
is used:
Set-AzVMExtension -ResourceGroupName “ResourceGroup” -VMName “VMName” -Name “ExtensionName” -Publisher “PublisherName” -ExtensionType “ExtensionType” -TypeHandlerVersion “Version” -Settings $SettingsObject
For Azure CLI, the command az vm extension set
is applied:
az vm extension set –resource-group ResourceGroup –vm-name VMName –name ExtensionName –publisher PublisherName –settings SettingsFile –version Version
– Custom Script Extension using Azure CLI:
az vm extension set \
–resource-group MyResourceGroup \
–vm-name MyVM \
–name CustomScript \
–publisher Microsoft.Azure.Extensions \
–settings ‘{ “fileUris”: [“http://example.com/script.sh”], “commandToExecute”: “./script.sh” }’
– DSC Extension with Azure PowerShell:
$ConfigurationArgument = @{
“nodeName” = “localhost”;
“MOFURL” = “<URL to the .mof file>”;
“ConfigurationData” = “<URL to the .pdt file>”;
}
Set-AzVmDscExtension -ResourceGroupName “MyResourceGroup” -VMName “MyVM” -ArchiveBlobName “MyDscConfiguration.zip” -AutoUpdate:$true -ConfigurationDataUri $ConfigurationArgument[“ConfigurationData”] -ConfigurationName “MyConfig” -ModuleVersion “2.76” -Name “Dsc” -Version “2.9”
/var/log/azure/
(Linux) or C:\WindowsAzure\Logs
(Windows).Get-AzVMExtension
, or in CLI with az vm extension list
.VM extensions provide a powerful way to manage, configure, and troubleshoot Azure VMs post-deployment. As an Azure Administrator, knowing how to deploy, manage, and diagnose these extensions forms an important part of the skill set needed for the AZ-104 certification. Remember to adhere to best practices and security measures when working with VM extensions to ensure your Azure environment’s optimal performance and security.
Answer: False
Explanation: VM extensions can be added both during VM creation and after the VM has been provisioned.
Answer: Azure Resource Manager
Explanation: Azure Resource Manager is used to deploy and manage VM extensions as part of Azure resource templates.
Answer: False
Explanation: While some extensions may require a restart, it is not always necessary to restart a VM to complete the installation of an extension.
Answer: Antivirus installation, Custom Script Execution, File backups
Explanation: VM extensions can be used to configure antivirus installation, execute custom scripts, and process file backups. VM size scaling is done through VM size properties, and network configuration is managed separately.
Answer: True
Explanation: Azure VM extensions can be deployed using Azure CLI, PowerShell, ARM templates, and through the Azure portal.
Answer: To execute scripts to configure VMs
Explanation: Azure Custom Script Extension is used to automatically execute scripts on Azure VMs to configure the VM after deployment.
Answer: True
Explanation: VM extensions are designed to enable post-deployment configuration and automation tasks inside Azure VMs.
Answer: Desired State Configuration (DSC)
Explanation: Desired State Configuration (DSC) is an extension that facilitates configuration management for VMs running on Azure.
Answer: False
Explanation: Some VM extensions are specific to Windows or Linux and cannot be used interchangeably.
Answer: Add-AzVMExtension, Set-AzVMExtension
Explanation: ‘Add-AzVMExtension’ is used to add a new extension to a VM, and ‘Set-AzVMExtension’ is used to update an existing extension or add a new one if it does not exist. ‘Get-AzVMExtension’ is used to retrieve extension details, and there’s no ‘Update-AzVMExtension’ cmdlet.
Answer: True
Explanation: Some VM extensions support installing specific versions of software packages on Azure VMs, offering granular control over the software deployment.
Answer: Infrastructure-as-a-Service (IaaS)
Explanation: Azure VM extensions are part of the Infrastructure-as-a-Service (IaaS) offering, as they directly interact with the virtual machine infrastructure.
VM extensions in Azure are software packages that can be installed on Azure VMs to add additional functionality.
VM extensions can be used to install and configure software, perform maintenance tasks, and enable advanced monitoring and diagnostics.
The Custom Script extension is a powerful tool that allows you to execute custom scripts on your Azure VMs.
To deploy the Custom Script extension on a Windows VM, open the Azure Portal, navigate to your VM, and click on the “Extensions” option in the left-hand menu. Then, click on the “Add” button and select the “Custom Script Extension” option from the list of available extensions.
To deploy the Custom Script extension on a Linux VM, open the Azure Portal, navigate to your Linux VM, and click on the “Extensions” option in the left-hand menu. Then, click on the “Add” button and select the “Custom Script Extension” option from the list of available extensions.
You can execute any type of script with the Custom Script extension, including PowerShell, Bash, and Python scripts.
Yes, you can pass command-line arguments to your script when using the Custom Script extension.
You specify the script file to execute with the Custom Script extension by providing the file path in the extension configuration.
Yes, you can execute multiple scripts with the Custom Script extension by specifying the file paths and command-line arguments for each script.
You can check the status of the Custom Script extension by navigating to the “Extensions” page for your VM and reviewing the status of the extension.
Yes, you can automate the deployment of the Custom Script extension by using Azure Resource Manager templates or the Azure CLI.
Other types of extensions available for Azure VMs include monitoring extensions, security extensions, and diagnostic extensions.
Yes, you can develop your own custom VM extension using Azure PowerShell or the Azure CLI.
Yes, you can update or remove a VM extension after it has been deployed by navigating to the “Extensions” page for your VM and making the necessary changes.
You can troubleshoot issues with a VM extension by reviewing the extension logs, which are available in the Azure Portal or by using Azure PowerShell or the Azure CLI.
If this material is helpful, please leave a comment and support us to continue.