I started with Azure CLI as a way to avoid the clutter that is ARM templates.

I ran into a limitation... which ... I don't remember anymore. Some configuration wasn't clear... Someone recommended switching to Azure Powershell... Something... ?
OH - Right! I was trying to use bash - there was a \r everywhere, crapping things out.

No - It wasn't my file.
Seriously, I checked. A dozen times.

Anyway - I've started using Azure PowerShell.
I've gotten some other pretty heavy recommendations to use YAML or Terraform as the build and deploy... I'll switch to YAML to have the IaC tied to the code.

Right now though, just bashing my head against how to get Az PowerShell to function for everything I want to do.

My biggest issue right now has been getting App Insights tied to my Functions App. A week I've spent trying to find the right API.

I'v reached out to the Azure Dev Ops team for a recommendation on how to move forward... but I took another approach.
Well... I kept beating my head against things. I can't stop. I FINALLY managed to get it working...

I had to add the App Insights through the portal and then I compared the export template JSON.
This gave me a new tag in the Application Insights. Given I can abuse all things in Azure Powershell... I just added the tag.

 {
    "type": "microsoft.insights/components",
    "apiVersion": "2015-05-01",
    "name": "[parameters('components_AppInsights_name')]",
    "location": "westus",
    "tags": {
        "hidden-link:/subscriptions/{SUBSCRIPTION_GUID}/resourceGroups/Dev_ResourceGroup/providers/Microsoft.Web/sites/devfunctions": "Resource"
    },
    "kind": "web",
    "properties": {
        "Application_Type": "web",
        "Request_Source": "AzurePowerShell"
    }
}

That tags value. That's the damn thing I had to hunt down.

I hope there's a better way... but I'm not blocked. :)

The Fix

If you're using Azure Powershell and need to add Application Insights (App Insights) to your Function App App Service, then you'll need to define tags for the Application Insights when you create it. Maybe when you update? I couldn't find how to update the value in. I suspect that it's through Set-AzResource instead of something AppInsights specific.

End

The CLI is awesome, as I said, but I'm having fun with the powershell. I think it operates a little better.

Short post - but OMG - finally got past adding app insights to the Function App. Took me a solid week of bashing my head against it.