Set-AzureRMVMDiagnosticsExtension
Configures the Azure diagnostics extension on a virtual machine.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
Set-AzureRMVMDiagnosticsExtension
[-ResourceGroupName] <String>
[-VMName] <String>
[-DiagnosticsConfigurationPath] <String>
[[-StorageAccountName] <String>]
[[-StorageAccountKey] <String>]
[[-StorageAccountEndpoint] <String>]
[[-StorageContext] <IStorageContext>]
[[-Location] <String>]
[[-Name] <String>]
[[-TypeHandlerVersion] <String>]
[[-AutoUpgradeMinorVersion] <Boolean>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Set-AzureRmVMDiagnosticsExtension cmdlet configures the Azure diagnostics extension on a virtual machine.
Examples
Example 1: Enable diagnostics using a storage account specified in a diagnostics configuration file
PS C:\> Set-AzureRmVMDiagnosticsExtension -ResourceGroupName "ResourceGroup01" -VMName "VirtualMachine02" -DiagnosticsConfigurationPath "diagnostics_publicconfig.xml"
This command uses a diagnostics configuration file to enable diagnostics. The file diagnostics_publicconfig.xml contains the public XML configuration for the diagnostics extension including the name of the storage account to which diagnostics data will be sent. The diagnostics storage account must be in the same subscription as the virtual machine.
Example 2: Enable diagnostics using a storage account name
PS C:\> Set-AzureRmVMDiagnosticsExtension -ResourceGroupName "ResourceGroup1" -VMName "VirtualMachine2" -DiagnosticsConfigurationPath diagnostics_publicconfig.xml -StorageAccountName "MyStorageAccount"
This command uses the storage account name to enable diagnostics. If the diagnostics configuration does not specify a storage account name or if you want to override the diagnostics storage account name specified in the configuration file, use the StorageAccountName parameter. The diagnostics storage account must be in the same subscription as the virtual machine.
Example 3: Enable diagnostics using storage account name and key
PS C:\> Set-AzureRmVMDiagnosticsExtension -ResourceGroupName "ResourceGroup01" -VMName "VirtualMachine02" -DiagnosticsConfigurationPath "diagnostics_publicconfig.xml" -StorageAccountName "MyStorageAccount" -StorageAccountKey $storage_key
This command uses the storage account name and key to enable diagnostics. If the diagnostics storage account is in a different subscription than the virtual machine then enable sending diagnostics data to that storage account by explicitly specifying its name and key.
Parameters
-AutoUpgradeMinorVersion
Indicates whether this cmdlet allows the Azure guest agent to automatically update the extension to a newer minor version.
Type: | Boolean |
Position: | 10 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DiagnosticsConfigurationPath
Specifies the path of the configuration file.
Type: | String |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Location
Specifies the location of the virtual machine.
Type: | String |
Position: | 7 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
Specifies the name of an extension.
Type: | String |
Aliases: | ExtensionName |
Position: | 8 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
Specifies the name of the resource group of the virtual machine.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageAccountEndpoint
Specifies the storage account endpoint.
Type: | String |
Position: | 5 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageAccountKey
Specifies the storage account key.
Type: | String |
Position: | 4 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageAccountName
Specifies the storage account name.
Type: | String |
Position: | 3 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageContext
Specifies the Azure storage context.
Type: | IStorageContext |
Position: | 6 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TypeHandlerVersion
Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter.
Type: | String |
Aliases: | HandlerVersion, Version |
Position: | 9 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-VMName
Specifies the name of the virtual machine on which this cmdlet operates.
Type: | String |
Aliases: | ResourceName |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |