[英]Easiest way to create and upload a self-signed certificate to Azure App Service
I'm looking for some CLI commands or a script of some sort that I can execute to do the following in one step我正在寻找一些 CLI 命令或某种类型的脚本,我可以执行这些命令以一步完成以下操作
Has anyone done this before?有没有人这样做过?
1. Create a self-signed certificate 1. 创建自签名证书
If you want to create a self-signed certificate, we can use OpenSSL to implement it.如果要创建自签名证书,我们可以使用OpenSSL来实现。 For more details, please refer to here and here有关更多详细信息,请参阅此处和此处
a.一个。 Create the certificate key and the signing (csr).创建证书密钥和签名 (csr)。
openssl req -new -x509 \
-newkey rsa:2048 \
-sha256 \
-days 3650 \
-nodes \
-out example.crt \
-keyout example.key \
-subj "/C=SI/ST=Ljubljana/L=Ljubljana/O=Security/OU=IT Department/CN=www.example.com"
The fields, specified in -subj
line are listed below:下面列出了在-subj
行中指定的字段:
C=
- Country name. C=
- 国家名称。 The two-letter ISO abbreviation.两个字母的 ISO 缩写。ST=
- State or Province name. ST=
- State 或省名。L=
- Locality Name. L=
- 地区名称。 The name of the city where you are located.您所在城市的名称。O=
- The full name of your organization. O=
- 您的组织的全名。OU=
- Organizational Unit. OU=
- 组织单位。CN=
- The fully qualified domain name CN=
- 完全限定域名b.湾。 Generate the certificate生成证书
openssl pkcs12 \
-inkey example.key \
-in example.crt \
-export -out example.pfx \
-password pass:<your password>
2. Upload it to my Azure App Service and save the certificate thumbprint in Azure App service app settings 2. 上传到我的 Azure App Service 并将证书指纹保存在 Azure App service app settings 中
Regarding the issue, please refer to the following code关于这个问题,请参考以下代码
az login
# Upload the SSL certificate and get the thumbprint.
thumbprint=$(az webapp config ssl upload --certificate-file $pfxPath \
--certificate-password $pfxPassword --name $webappname --resource-group $resourceGroup \
--query thumbprint --output tsv)
# save thumbprint
az webapp config appsettings set --name $appName --resource-group myResourceGroup \
--settings "Certificate _Thumbprint=$thumbprint"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.