首页 > 解决方案 > 如何在 Azure 中使用 Python SDK 设置 enable_https_traffic_only?

问题描述

我正在尝试编写一个 Python 脚本以在 Azure 存储帐户上启用“启用安全传输”。我在理解以下代码需要输入的内容时遇到了一些麻烦:

storage_account = storage_client.storage_accounts.update(
    GROUP_NAME, STORAGE_ACCOUNT_NAME, 
    StorageAccountUpdateParameters(enable_https_traffic_only(bool=true))
)

我已经尝试了几乎所有我能想到的将这个值设置为 true 的组合,有没有人让这个场景工作?

标签: pythonazureazure-storageazure-sdk-python

解决方案


您的代码不是有效的 Python:

storage_account = storage_client.storage_accounts.update(
    GROUP_NAME, STORAGE_ACCOUNT_NAME, 
    StorageAccountUpdateParameters(enable_https_traffic_only = True)
)

此页面可能会有所帮助: https ://github.com/Azure-Samples/storage-python-manage/blob/master/example.py


推荐阅读