我无法通过az cli设置流量管理器配置文件的预期代码范围。
我得到了错误:
Unable to build a model: Cannot deserialize as [MonitorConfigExpectedStatusCodeRangesItem] an object of type , DeserializationError: Cannot deserialize as [MonitorConfigExpectedStatusCodeRangesItem] an object of type Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 573, in body data = deserializer._deserialize(data_type, data) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1260, in _deserialize self._deserialize(local_type, value) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1260, in _deserialize self._deserialize(local_type, value) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1269, in _deserialize return self.deserialize_data(data, response) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1445, in deserialize_data return self.deserialize_type[iter_type](data, data_type[1:-1]) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1474, in deserialize_iter type(attr) msrest.exceptions.DeserializationError: Cannot deserialize as [MonitorConfigExpectedStatusCodeRangesItem] an object of type During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 197, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 373, in execute six.reraise(*sys.exc_info()) File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise raise value File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 347, in execute result = cmd(params) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 182, in __call__ return self.handler(*args, **kwargs) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/arm.py", line 512, in handler result = setter(**setterargs) File "/opt/az/lib/python3.6/site-packages/azure/mgmt/trafficmanager/operations/profiles_operations.py", line 347, in create_or_update body_content = self._serialize.body(parameters, 'Profile') File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 576, in body SerializationError, "Unable to build a model: "+str(err), err) File "/opt/az/lib/python3.6/site-packages/msrest/exceptions.py", line 54, in raise_with_traceback raise error.with_traceback(exc_traceback) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 573, in body data = deserializer._deserialize(data_type, data) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1260, in _deserialize self._deserialize(local_type, value) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1260, in _deserialize self._deserialize(local_type, value) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1269, in _deserialize return self.deserialize_data(data, response) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1445, in deserialize_data return self.deserialize_type[iter_type](data, data_type[1:-1]) File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 1474, in deserialize_iter type(attr) msrest.exceptions.SerializationError: Unable to build a model: Cannot deserialize as [MonitorConfigExpectedStatusCodeRangesItem] an object of type , DeserializationError: Cannot deserialize as [MonitorConfigExpectedStatusCodeRangesItem] an object of type
我已经在Azure中设置了TrafficManager配置文件,现在我想用预期的状态码范围更新该配置文件。创建期间无法设置。
我使用的命令是:
az network traffic-manager profile update --resource-group RG20BRAM-DEV --name test --set monitorConfig.expectedStatusCodeRanges='200'
谁能告诉我我在这里做错了什么?
诚挚的问候, 布拉姆
答案 0 :(得分:1)
您可以使用如下CLI命令更新Azure Traffic Manager配置文件:
az network traffic-manager profile update -g groupName -n trafficName --set monitorConfig.expectedStatusCodeRanges[0].max=301
和
az network traffic-manager profile update -g groupName -n trafficName --set monitorConfig.expectedStatusCodeRanges[0].min=301
看看Traffic Manager的属性,然后选择要以正确方式更新的属性。希望对您有帮助。
更新
更新的屏幕截图:
在创建概要文件时未设置属性monitorConfig.expectedStatusCodeRanges。您可以先使用CLI命令进行设置:
az network traffic-manager profile update -g charles -n charlesTrafficManager --set monitorConfig.expectedStatusCodeRanges='[{"min":200,"max":299}]'
该命令的屏幕截图执行: