Set-AzureVMDiagnosticsExtension

Configures the Azure Diagnostics extension on a virtual machine.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Set-AzureVMDiagnosticsExtension
   [-DiagnosticsConfigurationPath] <String>
   [[-StorageAccountName] <String>]
   [[-StorageAccountKey] <String>]
   [[-StorageAccountEndpoint] <String>]
   [[-StorageContext] <AzureStorageContext>]
   [[-Version] <String>]
   [-Disable]
   -VM <IPersistentVM>
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]
Set-AzureVMDiagnosticsExtension
   [-DiagnosticsConfigurationPath] <String>
   [[-StorageAccountName] <String>]
   [[-StorageAccountKey] <String>]
   [[-StorageAccountEndpoint] <String>]
   [[-StorageContext] <AzureStorageContext>]
   [[-Version] <String>]
   [-Disable]
   [[-ReferenceName] <String>]
   -VM <IPersistentVM>
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

The Set-AzureVMDiagnosticsExtension cmdlet configures the Microsoft Azure Diagnostics extension on a virtual machine.

Examples

Example 1: Create a virtual machine with Azure Diagnostics extension applied

PS C:\> $VM = New-AzureVMConfig -Name $VM -InstanceSize Small -ImageName $VMImage
PS C:\> $VM = Add-AzureProvisioningConfig -VM $VM -AdminUsername $Username -Password $Password -Windows
PS C:\> $VM = Set-AzureVMDiagnosticsExtension -DiagnosticsConfigurationPath $Config_Path -Version "1.*" -VM $VM -StorageContext $Storage_Context
PS C:\> New-AzureVM -Location $Location -ServiceName $Service_Name -VM $VM

These commands enable the Azure Diagnostics extension on a virtual machine.

Example 2: Enable an Azure Diagnostics extension on an existing virtual machine

PS C:\> $VM = Get-AzureVM -ServiceName $Service_Name -Name $VM_Name
PS C:\> $VM_Update = Set-AzureVMDiagnosticsExtension -DiagnosticsConfigurationPath $Config_Path -Version "1.*" -VM $VM -StorageContext $Storage_Context
PS C:\> Update-AzureVM -ServiceName $Service_Name -Name $VM_Name -VM $VM_Update.VM

The first command uses the Get-AzureVM cmdlet to get a virtual machine.

The second command uses the Set-AzureVMDiagnosticsExtension cmdlet to update the virtual machine configuration to include the Azure Diagnostics extension.

The final command applies the updated configuration to the virtual machine.

Parameters

-DiagnosticsConfigurationPath

Specifies a path for the diagnostics configuration.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Disable

Indicates that this cmdlet disables the diagnostics extension on the virtual machine.

Type:SwitchParameter
Position:6
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReferenceName

Specifies the reference name for the diagnostics extension.

Type:String
Position:7
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-StorageAccountEndpoint

Specifies a storage account endpoint.

Type:String
Position:3
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-StorageAccountKey

Specifies a storage account key.

Type:String
Position:2
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-StorageAccountName

Specifies a storage account name.

Type:String
Position:1
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-StorageContext

Specifies an Azure storage context.

Type:AzureStorageContext
Position:4
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Version

Specifies the extension version as a string.

Type:String
Position:5
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VM

Specifies the persistent virtual machine object.

Type:IPersistentVM
Aliases:InputObject
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False