I am not able to set expected code ranges for a Traffic Manager Profile via the az cli.
I get the error:
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
I have set up a TrafficManager profile in Azure and now I want to update that profile with the expected status code ranges. This is not able to be set during creation.
The command I use is:
az network traffic-manager profile update --resource-group RG20BRAM-DEV --name test --set monitorConfig.expectedStatusCodeRanges='200'
Anyone who can tell me what I am doing wrong here?
With kind regards, Bram
You can update the Azure Traffic Manager profile with the CLI command like this:
az network traffic-manager profile update -g groupName -n trafficName --set monitorConfig.expectedStatusCodeRanges[0].max=301
and
az network traffic-manager profile update -g groupName -n trafficName --set monitorConfig.expectedStatusCodeRanges[0].min=301
Take a look at the properties of Traffic Manager and then choose which one you want to update with the right way. Hope this will help you.
Update
The screenshot of the Update:
When you create the profile without setting the property monitorConfig.expectedStatusCodeRanges. You can first set it with the CLI command:
az network traffic-manager profile update -g charles -n charlesTrafficManager --set monitorConfig.expectedStatusCodeRanges='[{"min":200,"max":299}]'
The screenshot of the command execute: