pulumi / pulumi-azure-native

Azure Native Provider
Apache License 2.0
123 stars 32 forks source link

ListWebAppFunctionKeys returns all null values #593

Open UnoSD opened 3 years ago

UnoSD commented 3 years ago

When invoking

  var listWebAppFunctionKeysResult = ListWebAppFunctionKeys.InvokeAsync(new ListWebAppFunctionKeysArgs
  {
      Name              = "sitename",
      FunctionName      = "functionname",
      ResourceGroupName = "resourcegroupname"
  }).Result;

the resulting ListWebAppFunctionKeysResult has all nulls. I have tried invoking the REST API directly with:

az rest --method post --url https://management.azure.com/subscriptions/subId/resourceGroups/resourcegroupname/providers/Microsoft.Web/sites/sitename/functions/functionname/listkeys?api-version=2019-08-01

And it works as expected; I presume there could be a problem invoking it or in the deserialization or using the correct API version.

Would be nice if I could debug this further to give you more details, but I am having trouble getting Fiddler for Linux working in my distro; that triggered the idea of getting some verbose/debug logging for the provider to also include the REST URLs invoked with body. I will open another issue, hopefully that can be taken into consideration. Thank you.

EDIT:

I had a closer look at the code and the response; according to the MS documentation (and coherent with the Pulumi SDK), the REST call should return an object with { Id, Kind, Name, ... }, but it is returning instead an object: { keyName: KeyValue }. That may be the issue. I presume I need to raise a ticket with Microsoft for this to change the schema that feeds the autogenerated code in Pulumi...

UnoSD commented 3 years ago

thank you @mikhailshilkov , I will try it immediately, I tried v=9 and debug previously alone and did not help; I was assuming it was not achievable currently (ver 0.51). I will try it immediately, thank you.

By the way, I raised an issue on the MS spec GitHub: https://github.com/Azure/azure-rest-api-specs/issues/12889

Given that this is not a Pulumi issue, I'll close the ticket

Thank you

mikhailshilkov commented 3 years ago

I think you may need 0.6.0

mikhailshilkov commented 3 years ago

Regarding the issue, it's an API issue that I reported a while ago https://github.com/Azure/azure-rest-api-specs/issues/11401

UnoSD commented 3 years ago

Ah, that goes back to October, not good. They may fix it in the next ver; in the meanwhile I am using the old provider as fallback.

mikhailshilkov commented 3 years ago

I'll keep the issue open for now to see what we can do

mikhailshilkov commented 3 years ago

FWIW, the .NET SDK is generated from the same API spec, and it seems to face the same problem. The method returns a StringDictionary:

public async Task<AzureOperationResponse<StringDictionary>> ListFunctionKeysWithHttpMessagesAsync(string resourceGroupName, string name, string functionName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))

while StringDictionary does not match the over-the-wire shape:

public partial class StringDictionary : ProxyOnlyResource
{
    // ...
    [JsonProperty(PropertyName = "properties")]
    public IDictionary<string, string> Properties { get; set; }
}
darnmason commented 3 years ago

FWIW ListWebAppHostKeys works as expected and returns both the master key and the function keys.