我正在尝试使用 Python SDK 以编程方式创建新的 Azure 订阅。我发现的对 Azure Python SDK 的唯一引用是这个.
这是我最终的结果:
import azure.mgmt.billing
import azure.mgmt.subscription
creds = AzureCliCredential()
client_name = 'test'
def create_subscription(creds, client_name):
subscription_client = azure.mgmt.subscription.SubscriptionClient(creds)
creation_parameters = azure.mgmt.subscription.models.SubscriptionCreationParameters(
offer_type = 'MS-AZR-0003P')
creation_result = subscription_client.subscription_factory.create_subscription_in_enrollment_account(
client_name,
creation_parameters)
return creation_result
output = create_subscription(creds, client_sub)
print(output)
错误: AttributeError: module 'azure.mgmt.subscription.models' has no attribute 'SubscriptionCreationParameters'
但是查看文档显示该类azure.mgmt.subscription.models
有一个SubscriptionCreationParameters
模块。
我在这里想念什么?