Certificate 如何使用azure powershell从公共证书(.cer和.pfx)中提取blob

Certificate 如何使用azure powershell从公共证书(.cer和.pfx)中提取blob,certificate,azure-web-app-service,azure-powershell,Certificate,Azure Web App Service,Azure Powershell,我正在尝试使用powershell将公共和私有证书上载到Azure web app。我正在使用下面的代码将证书上载到webapp。我遇到的问题是如何使用powershell从证书文件(public cert.cer、private cert.pfx)中提取这些公共/私有证书元数据(blob内容)和指纹 上面的代码上载公共证书并将其附加到webapp 但是我想使用powershell从系统中的.cer、.pfx文件中提取证书blob内容、指纹 为了尝试代码,我已经手动将此公共证书上载到我的weba

我正在尝试使用powershell将公共和私有证书上载到Azure web app。我正在使用下面的代码将证书上载到webapp。我遇到的问题是如何使用powershell从证书文件(public cert.cer、private cert.pfx)中提取这些公共/私有证书元数据(blob内容)和指纹

上面的代码上载公共证书并将其附加到webapp

但是我想使用powershell从系统中的.cer、.pfx文件中提取证书blob内容、指纹

为了尝试代码,我已经手动将此公共证书上载到我的webapp,下面的调用显示了blob内容。
获取AzureRmResource-ResourceGroupName DevUS_A_ApplicationServices 1-ResourceType Microsoft.Web/sites/publicCertificates-ResourceName“DevService”-ApiVersion 2018-02-01我解决了它。下面是读取.cer文件内容的代码

$fullpath = 'C:\Certs\mycert.cer' 
$pwd = ConvertTo-SecureString -String 'anyPwd' -AsPlainText -Force
$cert  = New-AzureRmApplicationGatewaySslCertificate -Name someCert -CertificateFile $fullpath -Password $pwd 

$PropertiesObject = @{
        blob=$cert.Data; 
        publicCertificateLocation= "CurrentUserMy";
        thumbprint= $certThumbPrint;
        ResourceType = "Microsoft.Web/sites/publicCertificates"
    }
我无法以这种方式读取指纹,但可以肯定的是,您可以将证书导入本地计算机并找到它

$fullpath = 'C:\Certs\mycert.cer' 
$pwd = ConvertTo-SecureString -String 'anyPwd' -AsPlainText -Force
$cert  = New-AzureRmApplicationGatewaySslCertificate -Name someCert -CertificateFile $fullpath -Password $pwd 

$PropertiesObject = @{
        blob=$cert.Data; 
        publicCertificateLocation= "CurrentUserMy";
        thumbprint= $certThumbPrint;
        ResourceType = "Microsoft.Web/sites/publicCertificates"
    }