你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Set-AzVMBootDiagnostic
Modifies boot diagnostics properties of a virtual machine.
Syntax
Set-AzVMBootDiagnostic
[-VM] <PSVirtualMachine>
[-Enable]
[[-ResourceGroupName] <String>]
[[-StorageAccountName] <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Set-AzVMBootDiagnostic
[-VM] <PSVirtualMachine>
[-Disable]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Set-AzVMBootDiagnostic cmdlet modifies boot diagnostics properties of a virtual machine.
Examples
Example 1: Enable boot diagnostics
$VM = Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "ContosoVM07"
Set-AzVMBootDiagnostic -VM $VM -Enable -ResourceGroupName "ResourceGroup11" -StorageAccountName "DiagnosticStorage"
Update-AzVM -VM $VM -ResourceGroupName "ResourceGroup11"
The first command gets the virtual machine named ContosoVM07 by using Get-AzVM. The command stores it in the $VM variable. The second command enables boot diagnostics for the virtual machine in $VM. Diagnostics data is stored in the specified account.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Disable
Indicates that this cmdlet disables the boot diagnostics for the virtual machine.
Type: | SwitchParameter |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Enable
Indicates that this cmdlet enables the boot diagnostics for the virtual machine.
Type: | SwitchParameter |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
Specifies the name of the resource group of storage account.
Type: | String |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageAccountName
Specifies the name of the storage account in which to save boot diagnostics data. If not provided, it will look for a StorageUri in the BootDiagnostic Profile in the PSVirtualMachine object provided in the '-VM' parameter. If StorageUri is null, it will default to used a managed storage account.
Type: | String |
Position: | 3 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-VM
Specifies the virtual machine for which this cmdlet changes boot diagnostics. To obtain a virtual machine object, use the Get-AzVM cmdlet.
Type: | PSVirtualMachine |
Aliases: | VMProfile |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |