我需要从存储在 azure 门户上的证书获取 SSH 公钥,并且我已经在 azure 自动化上创建了工作流并将证书导入到 azure 门户。获得 SSH 公钥后,我必须使用此 SSH 公钥创建 Linux VM(从我的端准备好此脚本,无需添加 SSH key )。
最佳答案
根据我的理解,您的证书应该是 DER 编码的 X.509 证书,扩展名为 .cer。
您可以使用以下 PowerShell 脚本从您的证书中获取公钥:
$certPath = "testcert.cer"
$x509Cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromCertFile($certPath)
$pk = $x509Cert.GetPublicKeyString()
希望这对您有所帮助!
关于linux - 如何从 azure 自动化证书中获取公钥,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34655007/