你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

使用受信任签名对 CI 策略进行签名

本文介绍如何使用受信任签名服务对新代码完整性 (CI) 策略进行签名。

先决条件

若要完成本文中的步骤,需要:

对 CI 策略进行签名

  1. 打开 PowerShell 7

  2. (可选)可以创建类似于以下示例的 metadata.json 文件:("Endpoint" URI 值必须与设置这些资源时创建受信任签名帐户和证书配置文件所在的区域匹配。)

    {
    "Endpoint":"https://xxx.codesigning.azure.net/",
    "CodeSigningAccountName":"<Trusted Signing Account Name>",
    "CertificateProfileName":"<Certificate Profile Name>"
    }
    
  3. 获取要添加到信任存储的根证书

    Get-AzCodeSigningRootCert -AccountName TestAccount -ProfileName TestCertProfile -EndpointUrl https://xxx.codesigning.azure.net/ -Destination c:\temp\root.cer
    

    如果使用 metadata.json 文件,请改为运行以下命令:

    Get-AzCodeSigningRootCert -MetadataFilePath C:\temp\metadata.json https://xxx.codesigning.azure.net/ -Destination c:\temp\root.cer 
    
  4. 若要获取增强型密钥使用 (EKU) 以插入到策略中:

    Get-AzCodeSigningCustomerEku -AccountName TestAccount -ProfileName TestCertProfile -EndpointUrl https://xxx.codesigning.azure.net/ 
    

    如果使用 metadata.json 文件,请改为运行以下命令:

    Get-AzCodeSigningCustomerEku -MetadataFilePath C:\temp\metadata.json 
    
  5. 若要对策略进行签名,请运行 invoke 命令:

    Invoke-AzCodeSigningCIPolicySigning -accountName TestAccount -profileName TestCertProfile -endpointurl "https://xxx.codesigning.azure.net/" -Path C:\Temp\defaultpolicy.bin -Destination C:\Temp\defaultpolicy_signed.bin -TimeStamperUrl: http://timestamp.acs.microsoft.com 
    

    如果使用 metadata.json 文件,请改为运行以下命令:

    Invoke-AzCodeSigningCIPolicySigning -MetadataFilePath C:\temp\metadata.json -Path C:\Temp\defaultpolicy.bin -Destination C:\Temp\defaultpolicy_signed.bin -TimeStamperUrl: http://timestamp.acs.microsoft.com 
    

创建和部署 CI 策略

有关创建和部署 CI 策略的步骤,请参阅以下文章: