【发布时间】:2021-08-02 09:51:34
【问题描述】:
# Obtain the management object for resources, using the credentials from the CLI login.
tm_client = TrafficManagerManagementClient(credentials, subscription_id)
result = tm_client.profiles.create_or_update(
RESOURCE_GROUP_NAME,
'new_tm_profile',
{
'location': 'Global',
'profile_status': 'Enabled',
'traffic_routing_method': 'Priority',
'dns_config':
{
'relative_name': 'tmtest',
'ttl': 60
},
'monitor_config':
{
'protocol': 'HTTPS',
'port': 80,
'path': '/'
}
}
)
print(result.id)
它会抛出这个错误:
Traceback (most recent call last):
File "c:/Users/kumarreddy/Downloads/BOS_5Y_DATA/Working_Python_Ansible_Azure/Azure_VM_DB_Python/tm_profile.py", line 48, in <module>
result = tm_client.profiles.create_or_update(
File "C:\Python38-32\lib\site-packages\azure\mgmt\trafficmanager\operations\profiles_operations.py", line 349, in create_or_update
raise exp
msrestazure.azure_exceptions.CloudError: 400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/02ac19d2-71ae-471d-b697-97daef2db017/resourceGroups/tm_resgroup/providers/Microsoft.Network/trafficmanagerprofiles/new_tm_profile?api-version=2017-05-01
【问题讨论】:
标签: python azure azure-sdk-python azure-traffic-manager