你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
先决条件
如果没有 Azure 订阅,请在开始之前创建一个免费帐户。
开始
使用以下 CLI 命令安装此扩展
az extension add --name attestation检查版本
az extension show --name attestation --query version使用以下命令登录到 Azure:
az login如果需要,请切换到 Azure Attestation 订阅:
az account set --subscription 00000000-0000-0000-0000-000000000000使用 az provider register 命令在订阅中注册 Microsoft.Attestation 资源提供程序:
az provider register --name Microsoft.Attestation有关 Azure 资源提供程序以及如何配置和管理它们的详细信息,请参阅 Azure 资源提供程序和类型。
注释
只需为订阅注册一次资源提供程序。
为证明服务提供者创建资源组。 可以将其他 Azure 资源放在同一资源组中,包括具有客户端应用程序实例的虚拟机。 运行 az group create 命令以创建资源组,或使用现有资源组:
az group create --name attestationrg --location uksouth
创建和管理证明提供程序
下面是可用于创建和管理证明提供程序的命令:
运行 az attestation create 命令,在不要求策略签名的情况下创建证明提供程序:
az attestation create --name "myattestationprovider" --resource-group "MyResourceGroup" --location westus运行 az attestation show 命令检索证明提供程序属性(例如 status 和 AttestURI):
az attestation show --name "myattestationprovider" --resource-group "MyResourceGroup"此命令显示类似于以下输出的值:
Id:/subscriptions/MySubscriptionID/resourceGroups/MyResourceGroup/providers/Microsoft.Attestation/attestationProviders/MyAttestationProvider Location: MyLocation ResourceGroupName: MyResourceGroup Name: MyAttestationProvider Status: Ready TrustModel: AAD AttestUri: https://MyAttestationProvider.us.attest.azure.net Tags: TagsTable:
可以使用 az attestation delete 命令删除证明提供程序:
az attestation delete --name "myattestationprovider" --resource-group "sample-resource-group"
策略管理
使用此处所述的命令可为证明提供程序(一次一个证明类型)提供策略管理。
az attestation policy show 命令返回指定 TEE 的当前策略:
az attestation policy show --name "myattestationprovider" --resource-group "MyResourceGroup" --attestation-type SGX-IntelSDK
注释
该命令以文本和 JWT 格式显示策略。
当前支持的 TEE 类型如下:
SGX-IntelSDKSGX-OpenEnclaveSDKTPM
使用 az attestation policy set 命令为指定的证明类型设置新策略。
若要通过文件路径为某种证明类型设定文本格式的政策:
az attestation policy set --name testatt1 --resource-group testrg --attestation-type SGX-IntelSDK --new-attestation-policy-file "{file_path}"
若要使用文件路径以 JWT 格式为给定类型的证明设置策略,请运行以下命令:
az attestation policy set --name "myattestationprovider" --resource-group "MyResourceGroup" \
--attestation-type SGX-IntelSDK -f "{file_path}" --policy-format JWT