部署已啟用受信任啟動的虛擬機
適用於: ✔️ Linux VM ✔️ Windows VM ✔️ 彈性擴展集✔️統一擴展集。
可信啟動是改善 第 2 代 VM 安全性的方法。 可信啟動藉由結合 vTPM 和安全開機等基礎結構技術,防範進階和持續性攻擊技術。
必要條件
如果訂用帳戶尚未上線,建議您將訂用帳戶上線至 適用於雲端的 Microsoft Defender。 適用於雲端的 Microsoft Defender 具有免費層,可提供各種 Azure 和混合式資源的實用見解。 如果沒有 MDC,受信任的啟動虛擬機使用者就無法監視 VM 的開機完整性 。
將 Azure 原則方案指派給您的訂用帳戶。 每個訂用帳戶只需獲指派一次這些原則方案。 原則可協助部署、稽核信任啟動 虛擬機器,同時自動在所有支援的 VM 上安裝所有必要的擴充功能。
- 設定信任啟動 虛擬機器 內建原則計劃
- 設定必要條件以在已啟用可信啟動的 VM 上啟用來賓證明。
- 設定機器以在虛擬機器上自動安裝 Azure 監視器和 Azure 安全性代理程式。
允許網路安全組輸出規則中的 AzureAttestation 服務標籤,以允許Microsoft Azure 證明的流量。 請參閱虛擬網路服務標籤。
請確定防火牆原則允許存取 *.attest.azure.net
。
注意
如果您使用 Linux 映像,並預期 VM 可能具有未簽署或未由 Linux 散發版本廠商簽署的核心驅動程式,則您可能想要考慮關閉安全開機。 在 Azure 入口網站的 [建立虛擬機] 頁面的 [安全性類型] 參數中,選取 [可信啟動虛擬機器],按兩下 [設定安全性功能],然後取消核取 [啟用安全開機] 核取方塊。 在 CLI、PowerShell 或 SDK 中,將安全開機參數設定為 false。
部署受信任的啟動 VM
建立已啟用可信啟動的虛擬機器。 選擇下列選項:
- 登入 Azure 入口網站。
- 搜尋 [虛擬機器]。
- 在 [服務] 底下,選取 [虛擬機器]。
- 在 [虛擬機器] 頁面中,選取 [新增],然後選取 [虛擬機器]。
- 在 [專案詳細資料] 下方,確定已選取正確的訂用帳戶。
- 在 [資源群組] 下方,選取 [新建] 並為您的資源群組輸入名稱,或從下拉式清單中選取現有的資源群組。
- 在 [執行個體詳細資料] 下方,輸入虛擬機器名稱的名稱,然後選擇支援可信啟動的區域。
- 針對 [安全性類型],選取 [可信啟動虛擬機器]。 這讓三個選項出現 - 安全開機、 vTPM 和 完整性監視 。 為您的部署選取適當的選項。 深入了解可信啟動啟用安全性功能。
- 在 [映像] 下方,從 [與可信啟動相容的建議第 2 代映像] 中選取映像。 如需清單,請參閱可信啟動。
提示
如果您在下拉式清單中看不到您想要的映像第 2 代版本,請選取 [查看所有映像],然後將 [安全性類型] 篩選條件變更為 [可信啟動]。
- 選取支援可信啟動的 VM 大小。 請查看支援的大小清單。
- 填寫系統管理員帳戶資訊,然後填寫輸入連接埠規則。
- 在頁面底部,選取 [檢閱 + 建立]
- 在 [建立虛擬機器] 頁面上,您可以看到即將部署的 VM 詳細資料。 一旦驗證顯示為通過,請選取 [建立]。
可能需要幾分鐘的時間才能部署好 VM。
請確定您執行的是最新版的 Azure CLI。
使用 az login
登入 Azure。
az login
建立具有可信啟動的虛擬機器。
az group create -n myresourceGroup -l eastus
az vm create \
--resource-group myResourceGroup \
--name myVM \
--image Canonical:UbuntuServer:18_04-lts-gen2:latest \
--admin-username azureuser \
--generate-ssh-keys \
--security-type TrustedLaunch \
--enable-secure-boot true \
--enable-vtpm true
針對現有的 VM,您可以啟用或停用安全開機和 vTPM 設定。 使用安全開機和 vTPM 設定更新虛擬機會觸發自動重新啟動。
az vm update \
--resource-group myResourceGroup \
--name myVM \
--enable-secure-boot true \
--enable-vtpm true
如需透過客體證明延伸模組安裝開機完整性監視的詳細資訊,請參閱開機完整性。
若要佈建具有可信啟動的 VM,首先必須使用 Set-AzVmSecurityProfile
Cmdlet 搭配 TrustedLaunch
來啟用該 VM。 然後,您可以使用 Set-AzVmUefi Cmdlet,來設定 vTPM 和 SecureBoot 設定。 使用下列程式碼片段作為快速入門,請記得將此範例中的值取代為您自己的值。
$rgName = "myResourceGroup"
$location = "West US"
$vmName = "myTrustedVM"
$vmSize = Standard_B2s
$publisher = "MicrosoftWindowsServer"
$offer = "WindowsServer"
$sku = "2019-datacenter-gensecond"
$version = latest
$cred = Get-Credential `
-Message "Enter a username and password for the virtual machine."
$vm = New-AzVMConfig -VMName $vmName -VMSize $vmSize
$vm = Set-AzVMOperatingSystem `
-VM $vm -Windows `
-ComputerName $vmName `
-Credential $cred `
-ProvisionVMAgent `
-EnableAutoUpdate
$vm = Add-AzVMNetworkInterface -VM $vm `
-Id $NIC.Id
$vm = Set-AzVMSourceImage -VM $vm `
-PublisherName $publisher `
-Offer $offer `
-Skus $sku `
-Version $version
$vm = Set-AzVMOSDisk -VM $vm `
-StorageAccountType "StandardSSD_LRS" `
-CreateOption "FromImage"
$vm = Set-AzVmSecurityProfile -VM $vm `
-SecurityType "TrustedLaunch"
$vm = Set-AzVmUefi -VM $vm `
-EnableVtpm $true `
-EnableSecureBoot $true
New-AzVM -ResourceGroupName $rgName -Location $location -VM $vm
您可以使用快速入門範本來部署可信啟動 VM:
Linux
Windows
從 Azure Compute Gallery 映像部署可信啟動的虛擬機器
Azure 可信啟動虛擬機支援使用 Azure Compute Gallery 建立和共用自訂映像。 您可以根據映像的安全性類型,建立兩種類型的映像:
可信啟動虛擬機器支援的映像
針對下列映像來源,映像定義上的安全性類型應設定為 TrustedLaunchsupported
:
- Gen2 OS 磁碟 VHD
- Gen2 受控映像
- Gen2 資源庫映像版本
映像來源中不得包含任何虛擬機器客體狀態資訊。
產生的映像版本可用來建立 Azure Gen2 虛擬機器或可信啟動虛擬機器。
您可以使用 Azure 計算資源庫 - 直接共用資源庫和 Azure 計算資源庫 - 社群資源庫來共用這些映像。
- 登入 Azure 入口網站。
- 在搜尋列中搜尋並選取虛擬機器映像版本
- 在 [虛擬機器映像版本] 頁面上,選取 [建立]。
- 在 [建立虛擬機器映像版本] 頁面上的 [基本] 索引標籤上:
- 選取 Azure 訂用帳戶。
- 選取現有的資源群組或建立新的資源群組。
- 選取 Azure 區域。
- 輸入映像版本號碼。
- 針對 [來源],選取 [記憶體 Blob] 或 [VHD] 或 [受控映像] 或其他虛擬機器映像版本
- 如果您選取 [記憶體 Blob (VHD)],請輸入 OS 磁碟 VHD (不含虛擬機器客體狀態)。 請務必使用 Gen 2 VHD。
- 如果您選取 [受控映像],請選取 Gen 2 虛擬機器的現有受控映像。
- 如果您選取 [虛擬機器映像版本],請選取現有的 Gen2 虛擬機器資源庫映像版本。
- 針對 [目標 Azure 計算資源庫],選取或建立資源庫以共用映像。
- 針對 [操作系統狀態],根據您的使用案例選取 [一般化] 或 [特製化]。 如果您使用受控映像作為來源,請一律選取 [一般化]。 如果您使用記憶體 Blob(VHD)並想要選取 [一般化],請遵循步驟以一般化 Linux VHD或一般化 Windows VHD,再繼續進行。 如果您使用現有的虛擬機器映像版本,請根據來源虛擬機器映像定義中使用的項目選取 [一般化] 或 [特製化]。
- 針對 [目標虛擬機器映像定義] 選取 [新建]。
- 在 [建立虛擬機器映像定義] 窗格中,輸入定義的名稱。 請確定安全性類型已設為 Trustedlaunch Supported。 輸入發行者、供應項目和 SKU 資訊。 然後選取 [確定]。
- 在 [ 復寫] 索引標籤上,視需要輸入映像複寫的複本計數和目標區域。
- 在 [ 加密] 索引標籤上,視需要輸入 SSE 加密相關信息。
- 選取 [檢閱 + 建立] 。
- 成功驗證組態之後,選取 [建立] 以完成映像的建立。
- 建立映像版本之後,請選取 [建立虛擬機器]。
- 在 [建立虛擬機器] 頁面的 [資源群組] 下方,選取 [新建] 並為您的資源群組輸入名稱,或從下拉式清單中選取現有的資源群組。
- 在 [執行個體詳細資料] 下方,輸入虛擬機器名稱的名稱,然後選擇支援可信啟動的區域。
- 選取 [可信啟動虛擬機] 作為安全性類型。 [安全開機] 和 [vTPM] 核取方塊會預設為啟用。
- 填寫系統管理員帳戶資訊,然後填寫輸入連接埠規則。
- 在驗證頁面上,檢閱虛擬機器的詳細資料。
- 驗證成功之後,選取 [建立] 以完成虛擬機器的建立。
請確定您執行的是最新版的 Azure CLI。
使用 az login
登入 Azure。
az login
建立具有 TrustedLaunchSupported
安全性類型的映像定義。
az sig image-definition create --resource-group MyResourceGroup --location eastus \
--gallery-name MyGallery --gallery-image-definition MyImageDef \
--publisher TrustedLaunchPublisher --offer TrustedLaunchOffer --sku TrustedLaunchSku \
--os-type Linux --os-state Generalized \
--hyper-v-generation V2 \
--features SecurityType=TrustedLaunchSupported
使用 OS 磁碟 VHD 來建立映像版本。 使用這裡所述的步驟,確定Linux VHD已在上傳至 Azure 記憶體帳戶 Blob 之前一般化。
az sig image-version create --resource-group MyResourceGroup \
--gallery-name MyGallery --gallery-image-definition MyImageDef \
--gallery-image-version 1.0.0 \
--os-vhd-storage-account /subscriptions/00000000-0000-0000-0000-00000000xxxx/resourceGroups/imageGroups/providers/Microsoft.Storage/storageAccounts/mystorageaccount \
--os-vhd-uri https://mystorageaccount.blob.core.windows.net/container/path_to_vhd_file
從上述映像版本建立受信任的啟動 VM。
adminUsername=linuxvm
az vm create --resource-group MyResourceGroup \
--name myTrustedLaunchVM \
--image "/subscriptions/00000000-0000-0000-0000-00000000xxxx/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/galleries/MyGallery/images/MyImageDef" \
--size Standard_D2s_v5 \
--security-type TrustedLaunch \
--enable-secure-boot true \
--enable-vtpm true \
--admin-username $adminUsername \
--generate-ssh-keys
建立具有 TrustedLaunchSupported
安全性類型的映像定義。
$rgName = "MyResourceGroup"
$galleryName = "MyGallery"
$galleryImageDefinitionName = "MyImageDef"
$location = "eastus"
$publisherName = "TrustedlaunchPublisher"
$offerName = "TrustedlaunchOffer"
$skuName = "TrustedlaunchSku"
$description = "My gallery"
$SecurityType = @{Name='SecurityType';Value='TrustedLaunchSupported'}
$features = @($SecurityType)
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -HyperVGeneration "V2" -OsState "Generalized" -OsType "Windows" -Description $description -Feature $features
若要建立映像版本,我們可以使用在建立期間一般化的現有 Gen2 資源庫映像版本。
$rgName = "MyResourceGroup"
$galleryName = "MyGallery"
$galleryImageDefinitionName = "MyImageDef"
$location = "eastus"
$galleryImageVersionName = "1.0.0"
$sourceImageId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myVMRG/providers/Microsoft.Compute/galleries/MyGallery/images/Gen2VMImageDef/versions/0.0.1"
New-AzGalleryImageVersion -ResourceGroupName $rgName -GalleryName $galleryName -GalleryImageDefinitionName $galleryImageDefinitionName -Name $galleryImageVersionName -Location $location -SourceImageId $sourceImageId
從上述映像版本建立可信啟動虛擬機器
$rgName = "MyResourceGroup"
$galleryName = "MyGallery"
$galleryImageDefinitionName = "MyImageDef"
$location = "eastus"
$vmName = "myVMfromImage"
$vmSize = "Standard_D2s_v5"
$imageDefinition = Get-AzGalleryImageDefinition `
-GalleryName $galleryName `
-ResourceGroupName $rgName `
-Name $galleryImageDefinitionName
$cred = Get-Credential `
-Message "Enter a username and password for the virtual machine"
# Network pieces
$subnetConfig = New-AzVirtualNetworkSubnetConfig `
-Name mySubnet `
-AddressPrefix 192.168.1.0/24
$vnet = New-AzVirtualNetwork `
-ResourceGroupName $rgName `
-Location $location `
-Name MYvNET `
-AddressPrefix 192.168.0.0/16 `
-Subnet $subnetConfig
$pip = New-AzPublicIpAddress `
-ResourceGroupName $rgName `
-Location $location `
-Name "mypublicdns$(Get-Random)" `
-AllocationMethod Static `
-IdleTimeoutInMinutes 4
$nsgRuleRDP = New-AzNetworkSecurityRuleConfig `
-Name myNetworkSecurityGroupRuleRDP `
-Protocol Tcp `
-Direction Inbound `
-Priority 1000 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange 3389 `
-Access Deny
$nsg = New-AzNetworkSecurityGroup `
-ResourceGroupName $rgName `
-Location $location `
-Name myNetworkSecurityGroup `
-SecurityRules $nsgRuleRDP
$nic = New-AzNetworkInterface `
-Name myNic `
-ResourceGroupName $rgName `
-Location $location `
-SubnetId $vnet.Subnets[0].Id `
-PublicIpAddressId $pip.Id `
-NetworkSecurityGroupId $nsg.Id
$vm = New-AzVMConfig -vmName $vmName -vmSize $vmSize | `
Set-AzVMOperatingSystem -Windows -ComputerName $vmName -Credential $cred | `
Set-AzVMSourceImage -Id $imageDefinition.Id | `
Add-AzVMNetworkInterface -Id $nic.Id
$vm = Set-AzVMSecurityProfile -SecurityType "TrustedLaunch" -VM $vm
$vm = Set-AzVmUefi -VM $vm `
-EnableVtpm $true `
-EnableSecureBoot $true
New-AzVM `
-ResourceGroupName $rgName `
-Location $location `
-VM $vm
可信啟動虛擬機器映像
針對下列映像來源,映像定義上的安全性類型應設定為 TrustedLaunch
:
- 可信啟動虛擬機器擷取
- 受控 OS 磁碟
- 受控 OS 磁碟快照集
產生的映像版本只能用來建立 Azure 可信啟動虛擬機器。
- 登入 Azure 入口網站。
- 若要從 VM 建立 Azure Compute Gallery 映像,請開啟現有可信啟動 VM,然後選取 [擷取]。
- 在下列的 [建立映像] 頁面中,允許映像以 VM 映像版本的形式共用至資源庫。 信任啟動 VM 不支援建立受控映像。
- 建立新的目標 Azure Compute Gallery,或選取現有的資源庫。
- 對於 [作業系統狀態],選取 [一般化] 或 [特製化]。 如果您想要建立一般化映像,則請先確定您已將 VM 一般化以移除機器特定資訊,再選取此選項。 如果可信啟動 Windows VM 上已啟用 Bitlocker 型加密,則您可能無法以相同的方式進行一般化。
- 藉由提供名稱、發行者、供應專案和 SKU 詳細數據,建立新的映像定義。 映像定義的 [安全性類型] 應該已設定為 [可信啟動]。
- 提供映像版本的版本號碼。
- 視需要修改複寫選項。
- 在 [建立映像] 頁面底部,選取 [檢閱 + 建立],並在驗證顯示為已通過時選取 [建立]。
- 建立映像版本之後,請直接移至映像版本。 也可以透過映像定義瀏覽至所需的映像版本。
- 在 [VM 映像版本] 頁面上,選取 [+ 建立 VM] 以進入 [建立虛擬機器] 頁面。
- 在 [建立虛擬機器] 頁面的 [資源群組] 下方,選取 [新建] 並為您的資源群組輸入名稱,或從下拉式清單中選取現有的資源群組。
- 在 [執行個體詳細資料] 下方,輸入虛擬機器名稱的名稱,然後選擇支援可信啟動的區域。
- 已根據選取的映像版本填入映像和安全性類型。 [安全開機] 和 [vTPM] 核取方塊會預設為啟用。
- 填寫系統管理員帳戶資訊,然後填寫輸入連接埠規則。
- 在頁面底部,選取 [檢閱 + 建立]
- 在驗證頁面上,檢閱虛擬機器的詳細資料。
- 驗證成功之後,選取 [建立] 以完成虛擬機器的建立。
如果您想要使用受控磁碟或受控磁碟快照集作為映射版本的來源(而不是受信任的啟動 VM),請使用下列步驟。
- 登入入口網站
- 搜尋「VM 映像版本」,然後選取 [建立]
- 提供訂用帳戶、資源群組、區域和映像版本號碼
- 將來源選取為 [磁碟和/或快照集]
- 從下拉式清單中,選取 OS 磁碟作為受控磁碟或受控磁碟快照集
- 選取 [目標 Azure 計算資源庫] 以建立和共用映像。 如果沒有資源庫,則請建立新的資源庫。
- 對於 [作業系統狀態],選取 [一般化] 或 [特製化]。 如果您想要建立一般化映像,則請確定您已將磁碟或快照集一般化以移除機器特定資訊。
- 針對 [目標 VM 映像定義] 選取 [新建]。 在開啟的視窗中,選取映像定義名稱,並確定 [安全性類型] 設定為 [可信啟動]。 提供發行者、供應項目和 SKU 資訊,然後選取 [確定]。
- 如有需要,可以使用 [複寫] 索引標籤來設定映像複寫的複本計數和目標區域。
- 如有需要,也可以使用 [加密] 索引標籤來提供 SSE 加密相關資訊。
- 在 [檢閱 + 建立] 索引標籤中,選取 [建立] 以建立映像
- 成功建立映像版本之後,請選取 [+ 建立 VM] 以進入 [建立虛擬機器] 頁面。
- 遵循先前所述的步驟 12 到 18,以使用此映像版本建立可信啟動虛擬機器
請確定您執行的是最新版的 Azure CLI。
使用 az login
登入 Azure。
az login
建立具有 TrustedLaunch
安全性類型的映像定義
az sig image-definition create --resource-group MyResourceGroup --location eastus \
--gallery-name MyGallery --gallery-image-definition MyImageDef \
--publisher TrustedLaunchPublisher --offer TrustedLaunchOffer --sku TrustedLaunchSku \
--os-type Linux --os-state Generalized \
--hyper-v-generation V2 \
--features SecurityType=TrustedLaunch
若要建立映像版本,我們可以擷取現有 Linux 型可信啟動 VM。 在建立映像版本之前,將可信啟動 VM 一般化。
az sig image-version create --resource-group MyResourceGroup \
--gallery-name MyGallery --gallery-image-definition MyImageDef \
--gallery-image-version 1.0.0 \
--managed-image /subscriptions/00000000-0000-0000-0000-00000000xxxx/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM
如果受控磁碟或受控磁碟快照集需要用作映像版本的映像來源,則請將上述命令中的 --managed-image 取代為 --os-snapshot,並提供磁碟或快照集資源名稱
從上述映像版本建立可信啟動虛擬機器
adminUsername=linuxvm
az vm create --resource-group MyResourceGroup \
--name myTrustedLaunchVM \
--image "/subscriptions/00000000-0000-0000-0000-00000000xxxx/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/galleries/MyGallery/images/MyImageDef" \
--size Standard_D2s_v5 \
--security-type TrustedLaunch \
--enable-secure-boot true \
--enable-vtpm true \
--admin-username $adminUsername \
--generate-ssh-keys
建立具有 TrustedLaunch
安全性類型的映像定義
$rgName = "MyResourceGroup"
$galleryName = "MyGallery"
$galleryImageDefinitionName = "MyImageDef"
$location = "eastus"
$publisherName = "TrustedlaunchPublisher"
$offerName = "TrustedlaunchOffer"
$skuName = "TrustedlaunchSku"
$description = "My gallery"
$SecurityType = @{Name='SecurityType';Value='TrustedLaunch'}
$features = @($SecurityType)
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -HyperVGeneration "V2" -OsState "Generalized" -OsType "Windows" -Description $description -Feature $features
若要建立映像版本,我們可以擷取現有 Windows 型可信啟動 VM。 在建立映像版本之前,將可信啟動 VM 一般化。
$rgName = "MyResourceGroup"
$galleryName = "MyGallery"
$galleryImageDefinitionName = "MyImageDef"
$location = "eastus"
$galleryImageVersionName = "1.0.0"
$sourceImageId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myVMRG/providers/Microsoft.Compute/virtualMachines/myVM"
New-AzGalleryImageVersion -ResourceGroupName $rgName -GalleryName $galleryName -GalleryImageDefinitionName $galleryImageDefinitionName -Name $galleryImageVersionName -Location $location -SourceImageId $sourceImageId
從上述映像版本建立可信啟動虛擬機器
$rgName = "MyResourceGroup"
$galleryName = "MyGallery"
$galleryImageDefinitionName = "MyImageDef"
$location = "eastus"
$vmName = "myVMfromImage"
$vmSize = "Standard_D2s_v5"
$imageDefinition = Get-AzGalleryImageDefinition `
-GalleryName $galleryName `
-ResourceGroupName $rgName `
-Name $galleryImageDefinitionName
$cred = Get-Credential `
-Message "Enter a username and password for the virtual machine"
# Network pieces
$subnetConfig = New-AzVirtualNetworkSubnetConfig `
-Name mySubnet `
-AddressPrefix 192.168.1.0/24
$vnet = New-AzVirtualNetwork `
-ResourceGroupName $rgName `
-Location $location `
-Name MYvNET `
-AddressPrefix 192.168.0.0/16 `
-Subnet $subnetConfig
$pip = New-AzPublicIpAddress `
-ResourceGroupName $rgName `
-Location $location `
-Name "mypublicdns$(Get-Random)" `
-AllocationMethod Static `
-IdleTimeoutInMinutes 4
$nsgRuleRDP = New-AzNetworkSecurityRuleConfig `
-Name myNetworkSecurityGroupRuleRDP `
-Protocol Tcp `
-Direction Inbound `
-Priority 1000 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange 3389 `
-Access Deny
$nsg = New-AzNetworkSecurityGroup `
-ResourceGroupName $rgName `
-Location $location `
-Name myNetworkSecurityGroup `
-SecurityRules $nsgRuleRDP
$nic = New-AzNetworkInterface `
-Name myNic `
-ResourceGroupName $rgName `
-Location $location `
-SubnetId $vnet.Subnets[0].Id `
-PublicIpAddressId $pip.Id `
-NetworkSecurityGroupId $nsg.Id
$vm = New-AzVMConfig -vmName $vmName -vmSize $vmSize | `
Set-AzVMOperatingSystem -Windows -ComputerName $vmName -Credential $cred | `
Set-AzVMSourceImage -Id $imageDefinition.Id | `
Add-AzVMNetworkInterface -Id $nic.Id
$vm = Set-AzVMSecurityProfile -SecurityType "TrustedLaunch" -VM $vm
$vm = Set-AzVmUefi -VM $vm `
-EnableVtpm $true `
-EnableSecureBoot $true
New-AzVM `
-ResourceGroupName $rgName `
-Location $location `
-VM $vm
信任啟動內建原則
為了協助終端用戶採用受信任的啟動,有 Azure 原則可協助資源擁有者採用受信任的啟動。 主要目標是協助轉換可信賴啟動的第 1 代和第 2 代 虛擬機器。 虛擬機應該已啟用 [信任啟動 ] 單一原則檢查虛擬機,目前是否已啟用信任啟動安全性設定。 受信任啟動 支援的磁碟和 OS 會檢查先前建立的虛擬機是否具有 能夠部署受信任啟動虛擬機的第 2 代作業系統和虛擬機大小 。 這兩個原則結合在一起,讓信任的啟動原則處於反覆狀態,讓您將數個相關的原則定義分組,以簡化指派和管理資源,以包含信任的啟動設定。
若要深入瞭解並開始部署,請參閱 受信任的啟動內建原則。
驗證或更新您的設定
針對已啟用可信啟動建立的虛擬機器,您可以造訪 Azure 入口網站中虛擬機器的 [概觀] 頁面,以檢視可信啟動設定。 [屬性] 索引標籤會顯示可信啟動功能的狀態:
若要變更可信啟動設定,請在左側功能表中,選取 [設定] 區段底下的 [組態]。 您可以從 [安全性類型] 區段啟用或停用安全開機、vTPM 和完整性監視。 完成時,選取 頁面頂端的 [儲存 ]。
如果 VM 正在執行,您會收到 VM 將重新啟動的訊息。 選取 [是],然後等候 VM 重新啟動,變更才會生效。
下一步
深入瞭解 受信任的啟動 和 開機完整性監視 VM。