Description
Link to sample
Library name and version
azure-mgmt-network 28.1.0
Language of the Sample
- C#/.NET
- Java
- JavaScript/TypedScript
- Python
- Golang
- Other - Please specify in Issue details field
Sample Issue Type
- Sample not working
- Sample missing
- Do not understand sample
Issue details
Using the code provided in the documentation:
response = client.express_route_cross_connections.begin_create_or_update(
resource_group_name="CrossConnection-SiliconValley",
cross_connection_name="<circuitServiceKey>",
parameters={"properties": {"serviceProviderProvisioningState": "NotProvisioned"}},
).result()
results in the following error:
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (LocationRequired) The location property is required for this definition.
Code: LocationRequired
Message: The location property is required for this definition.
Turns out the code needs "location" and expressRouteCircuit parameters to work correctly, so a working example would look like this:
response = client.express_route_cross_connections.begin_create_or_update(
resource_group_name="CrossConnection-SiliconValley",
cross_connection_name="<circuitServiceKey>",
parameters={"serviceProviderProvisioningState": "NotProvisioned",
"location": expressroute.location,
"expressRouteCircuit": {
"id": expressroute.express_route_circuit.id
}},
).result()
where expressroute is the ExpressRouteCrossConnect object being updated as returned from express_route_cross_connections.get() method
Expected behavior
expected behavior is for the example code to work (ie, not return any errors from the API) and result in the serviceProviderProvisioningState being updated to the given value.
Actual behavior
throws an error:
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (LocationRequired) The location property is required for this definition.
Code: LocationRequired
Message: The location property is required for this definition.
Reproduction Steps
- copy and paste the python code sample provided in the documentation
- run it
- see it return an error
Environment
python 3.12 running on Linux