Azure / azure-sdk-for-php

Microsoft Azure SDK for PHP
http://azure.microsoft.com/en-us/develop/php/
Apache License 2.0
415 stars 273 forks source link

Error throw by optional $expand param in getNetworkInterfaces and getPublicIPAddresses on `get` method #977

Open LTroya opened 6 years ago

LTroya commented 6 years ago

I am using NetworkManagementClient to retrieve public ip addresses and network interfaces, but get method trigger the following exception:

$expand query option value is invalid. The resource does not have property or the property does not represent a reference to another resource.

I have been looking for into the docs but I have not found information about this param.

Here is some snippet I am using:

$runTime = AzureStatic::create(self::APPLICATION_ID, self::TENANT_ID, self::CLIENT_SECRET);
$nmc = new NetworkManagementClient($runTime, self::SUBSCRIPTION_ID);

$nmc->getNetworkInterfaces()->get('RESOURCE_GROUP_NAME', 'NETWORK_INTERFACE_NAME')
$nmc->getPublicIPAddresses()->get('RESOURCE_GROUP_NAME', 'PUBLIC_IP_ADDRESS_NAME')

This is the final query:

https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.Network/networkInterfaces/NETWORK_INTERFACE_NAME?api-version=2017-08-01&$expand=

Notice $expand is blank. But in the source code it optional.

I looks like similar to the example on this page:

https://docs.microsoft.com/en-us/rest/api/virtualnetwork/publicipaddresses/get#examples

If the api-version is the problem, is there a way to change it?

Thanks in advance.