Jayden Navarro
Jayden Navarro

Reputation: 37

InvalidResourceType The resource type could not be found in the namespace Azure Python SDK Error

I'm hitting the following error when trying to run:

resource_client.resources.get( 'MyResourceGroup', 'Microsoft.Network', '/Resource/Group/Id', 'routeTables', 'Subnet-1-RouteTable', '2015-01-01' ):

For reference, here is the function documentation.

Error:

Message: The resource type could not be found in the namespace 'Microsoft.Network' for api version '2015-01-01'.

I've tried modifying the following without success:

I can't find a list of API versions, but I have seen 2015-01-01 thrown around so I used that here, but if someone has a list of APIs or one that will work for this resource type that would be great.

Upvotes: 1

Views: 3503

Answers (1)

Laurent Mazuel
Laurent Mazuel

Reputation: 3546

Is there a specific reason you don't want to use the "azure-mgmt-network" client directly? https://learn.microsoft.com/en-us/python/api/azure.mgmt.network.v2017_03_01.operations.routetablesoperations?view=azure-python

This should simplify a lot your situation.

To answer to your specific problem, I think "routeTable" just does not exist in 2015-01-01 (as the message said). This is an old ApiVersion, and that's not even supported in official SDKs. You should try 2017-03-01.

And about the call itself example, this unittest might help you: https://github.com/Azure/azure-sdk-for-python/blob/master/azure-mgmt/tests/test_mgmt_resource.py#L156-L164

But again, I strongly suggest you to just use the Network client and not generic Resource.

(I own the Python SDK at MS)

Upvotes: 1

Related Questions