Set-AzVMSecurityProfile
Beállítja Virtual Machines SecurityType enumerálását.
Syntax
Default (Alapértelmezett)
Set-AzVMSecurityProfile
[-VM] <PSVirtualMachine>
[-SecurityType <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
A Set-AzVMSecurityProfile parancsmag beállítja a virtuális gép biztonsági típusát
Példák
1. példa
$VM = Get-AzVM -ResourceGroupName "ResourceGroup11" -VMName "ContosoVM07"
$VM = Set-AzVMSecurityProfile -VM $VM -SecurityType "TrustedLaunch"
Az első parancs lekéri a ContosoVM07 nevű virtuális gépet a Get-AzVm használatával. A parancs a $VM változóban tárolja. A második parancs a SecurityType enum értékét "TrustedLaunch" értékre állítja. A megbízható indításhoz új virtuális gépekre van szükség. Az eredetileg anélkül létrehozott meglévő virtuális gépeken nem engedélyezheti a megbízható indítást.
2. példa: Hozzon létre egy ConfidentialVM virtuális gépet és a VMGuestStateOnly típussal titkosított lemezt.
$vmSize = "Standard_DC2as_v5";
$DNSNameLabel = "cvm1" +$ResourceGroupName;
$SubnetAddressPrefix = "10.0.0.0/24";
$VnetAddressPrefix = "10.0.0.0/16";
# Credential setup.
$securePassword = ConvertTo-SecureString -String "****" -AsPlainText -Force;
$credential = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
$SecurityType = "ConfidentialVM";
$vmDiskSecurityEncryptionType = "VMGuestStateOnly";
$VirtualMachine = New-AzVMConfig -VMName $VMName -VMSize $VMSize;
# Create the Network resources and VM OS setup.
$SingleSubnet = New-AzVirtualNetworkSubnetConfig -Name $SubnetName -AddressPrefix $SubnetAddressPrefix;
$Vnet = New-AzVirtualNetwork -Name $NetworkName -ResourceGroupName $rgname -Location $LocationName -AddressPrefix $VnetAddressPrefix -Subnet $SingleSubnet;
$PIP = New-AzPublicIpAddress -Name $PublicIPAddressName -DomainNameLabel $DNSNameLabel -ResourceGroupName $rgname -Location $LocationName -AllocationMethod Dynamic;
$NIC = New-AzNetworkInterface -Name $NICName -ResourceGroupName $rgname -Location $LocationName -SubnetId $Vnet.Subnets[0].Id -PublicIpAddressId $PIP.Id;
$VirtualMachine = Set-AzVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName $ComputerName -Credential $Credential -ProvisionVMAgent -EnableAutoUpdate;
$VirtualMachine = Add-AzVMNetworkInterface -VM $VirtualMachine -Id $NIC.Id;
$VirtualMachine = Set-AzVMSourceImage -VM $VirtualMachine -PublisherName 'MicrosoftWindowsServer' -Offer 'windowsserver' -Skus '2022-datacenter-smalldisk-g2' -Version 'latest';
$VirtualMachine = Set-AzVMOSDisk -VM $VirtualMachine -StorageAccountType "StandardSSD_LRS" -CreateOption "FromImage";
# Set the SecurityType and necessary values on the Uefi settings.
$VirtualMachine = Set-AzVMSecurityProfile -VM $VirtualMachine -SecurityType $SecurityType;
$VirtualMachine = Set-AzVMUefi -VM $VirtualMachine -EnableVtpm $true -EnableSecureBoot $true;
# Set the Disk Encryption Type.
$VirtualMachine = Set-AzVMOSDisk -VM $VirtualMachine -StorageAccountType "StandardSSD_LRS" -CreateOption "FromImage" -SecurityEncryptionType $vmDiskSecurityEncryptionType;
$vm = New-AzVM -ResourceGroupName $rgname -Location $LocationName -VM $VirtualMachine;
$vm = Get-AzVM -ResourceGroupName $rgname -Name $vmname;
# Verify SecurityType value.
# $vm.SecurityProfile.SecurityType == "ConfidentialVM";
Paraméterek
-DefaultProfile
A Azure való kommunikációhoz használt hitelesítő adatok, fiók, bérlő és előfizetés.
Paramétertulajdonságok
| Típus: | IAzureContextContainer |
| Alapértelmezett érték: | None |
| Támogatja a helyettesítő karaktereket: | False |
| DontShow: | False |
| Aliasok: | AzContext, AzureRmContext, AzureCredential |
Paraméterkészletek
(All)
| Position: | Named |
| Kötelező: | False |
| Folyamatból származó érték: | False |
| Folyamatból származó érték tulajdonságnév alapján: | False |
| Fennmaradó argumentumokból származó érték: | False |
-SecurityType
A virtuális gép SecurityType tulajdonságát adja meg. Az UefiSettings engedélyezéséhez minden megadott értékre be kell állítani. Alapértelmezés szerint az UefiSettings csak akkor lesz engedélyezve, ha ez a tulajdonság be van állítva.
Paramétertulajdonságok
| Típus: | String |
| Alapértelmezett érték: | None |
| Támogatja a helyettesítő karaktereket: | False |
| DontShow: | False |
Paraméterkészletek
(All)
| Position: | Named |
| Kötelező: | False |
| Folyamatból származó érték: | False |
| Folyamatból származó érték tulajdonságnév alapján: | True |
| Fennmaradó argumentumokból származó érték: | False |
-VM
A virtuálisgép-profil.
Paramétertulajdonságok
| Típus: | PSVirtualMachine |
| Alapértelmezett érték: | None |
| Támogatja a helyettesítő karaktereket: | False |
| DontShow: | False |
| Aliasok: | VMProfile |
Paraméterkészletek
(All)
| Position: | 0 |
| Kötelező: | True |
| Folyamatból származó érték: | True |
| Folyamatból származó érték tulajdonságnév alapján: | True |
| Fennmaradó argumentumokból származó érték: | False |
CommonParameters
Ez a parancsmag a következő gyakori paramétereket támogatja: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction és -WarningVariable. További információért lásd about_CommonParameters.