快速入門: 使用 Bicep 檔案建立 Azure 證明提供者

Microsoft Azure 證明 是用於證明受信任執行環境 (TEE) 的解決方案。 本快速入門著重於部署 Bicep 檔案以建立 Microsoft Azure 證明原則的流程。

Bicep 是一種網域特定語言 (DSL),使用宣告式語法來部署 Azure 資源。 其提供簡潔的語法、可靠的類型安全,並支援程式碼重複使用。 Bicep 為 Azure 中的基礎結構即程式代碼解決方案提供最佳撰寫體驗。

先決條件

如尚未擁有 Azure 訂用帳戶,請在開始之前先建立免費帳戶。

檢閱 Bicep 檔案

本快速入門中使用的 Bicep 檔案來自 Azure 快速入門範本。

@description('Name of the Attestation provider. Must be between 3 and 24 characters in length and use numbers and lower-case letters only.')
param attestationProviderName string = uniqueString(resourceGroup().name)

@description('Location for all resources.')
param location string = resourceGroup().location

param policySigningCertificates string = ''

var PolicySigningCertificates = {
  PolicySigningCertificates: {
    keys: [
      {
        kty: 'RSA'
        use: 'sig'
        x5c: [
          policySigningCertificates
        ]
      }
    ]
  }
}

resource attestationProvider 'Microsoft.Attestation/attestationProviders@2021-06-01' = {
  name: attestationProviderName
  location: location
  properties: (empty(policySigningCertificates) ? json('{}') : PolicySigningCertificates)
}

output attestationName string = attestationProvider.id
output location string = location
output resourceGroupName string = resourceGroup().name
output resourceId string = attestationProvider.id

Bicep 檔案中定義的 Azure 資源:

部署 Bicep 檔案

  1. 將 Bicep 檔案以 main.bicep 儲存至本機電腦。

  2. 使用 Azure CLI 或 Azure PowerShell 部署 Bicep 檔案。

    az group create --name exampleRG --location eastus
    
    az deployment group create --resource-group exampleRG --template-file main.bicep
    

    當部署完成時,您應該會看到訊息,指出部署成功。

驗證部署

使用 Azure 入口網站、Azure CLI 或 Azure PowerShell 來確認已建立資源群組和伺服器資源。

az resource list --resource-group exampleRG

清理資源

其他 Azure 證明會以本快速入門為基礎。 如果您打算繼續進行後續的快速入門和教學課程,您可以讓這些資源留在原處。

不再需要時,請刪除資源群組,這會刪除證明資源。 若要使用 Azure CLI 或 Azure PowerShell 刪除資源群組:

az group delete --name exampleRG

後續步驟

在此快速入門教學中,您已使用 Bicep 檔案建立鑑證資源,並驗證部署結果。 若要深入瞭解 Azure 證明,請參閱 Azure 證明概觀。