【发布时间】:2022-09-30 04:46:33
【问题描述】:
Microsoft Azure 文档中有一篇文章介绍了如何从门户网站Add a TLS/SSL certificate in Azure App Service。该页面链接到how to do the same thing from using the Azure cli 上的文档。
我的目标是做同样的事情,但使用本机 Python。我一直在查看azure.mgmt.web 包的文档,包括WebSiteManagementClient class 的文档。
问题: 有没有办法使用本机 Python 上传和绑定 PKCS12 私钥证书到 Azure Web 应用程序?我愿意考虑替代方案,例如上传公钥证书或使用 subprocess module 调用 Azure CLI 工具。
这是我到目前为止的代码:
from azure.mgmt.web import WebSiteManagementClient
from azure.identity import ClientSecretCredential
# Assume client_id, secret, tenant, resource_group, web_app_name are
# appropriately declared and instatiated
credentials = ClientSecretCredential(client_id=client_id,
client_secret=secret,
tenant_id=tenant)
with WebSiteManagementClient(credentials, subscription_id) as mng:
web_app = mng.web_apps.get(resource_group, web_app_name)
app_config = mng.web_apps.get_configuration(resource_group, web_app_name)
# TODO: upload Private Key (PKCS12) here
标签: python azure ssl azure-web-app-service pkcs#12