tfsaggregator / aggregator-cli

A new version of Aggregator aiming at Azure DevOps (ex Visual Studio Team Services)
https://tfsaggregator.github.io/
Apache License 2.0
73 stars 32 forks source link

Add.Rule fails after using namingtemplate to install instance #237

Closed wollstad closed 3 years ago

wollstad commented 3 years ago

Tried installing an instance with the following: { "FunctionAppPrefix": "func-", "FunctionAppSuffix": "", "HostingPlanPrefix": "hp-", "HostingPlanSuffix": "", "AppInsightPrefix": "aip-", "AppInsightSuffix": "", "StorageAccountPrefix": "strg", "StorageAccountSuffix": "" } This created a function app with a name like func-funcname

When running the add.rule command, the procedure fails in KuduApi.cs (GetPublishCredentials) because it is unable to get the web function app. (webFunctionApp variable is null -> NullreferenceException)

I found that this happens because the code is not trying to find "func-funcname". It is trying to find "func-funcnameaggregator". For giggles, I tried setting FunctionAppSuffix in BuiltInNamingTemplates to an empty string (as opposed to "aggregator"), which made it work.

image

I also tried specifying --namingtemplate with the same file as the installation, but this made no difference to the add.rule function. At the very least I would expect the namingtemplate to be used when specified, but what made this harder to troubleshoot was that the only error received was: System.NullReferenceException: Object reference not set to an instance of an object.

wollstad commented 3 years ago

After some more troubleshooting, I must admit that my original assessment was wrong. Using --namingtemplate [same json as install] indeed does work.

Is it possible to add some more verbose logging around this section of the code? Ie. logging the resource group and function app name that is used after applying the naming template?