rajeshmag
rajeshmag

Reputation: 121

PowerShell script to create an Application Insights resource with type: General

Every time I try create an Application Insights resource with

"Application_Type" = "General"

or

"Application_Type" = "Other"

using Azure Template, it is creating as "ASP.NET" type. It seems that the default value for "Application_Type" field is "ASP.NET" or "Web".

How do I create an Application Insights resource with "Application_Type" = "General" using ARM template? I specifically need an Application Insight instance of General type to collect logs from Azure AD B2C so that we can diagnose problems with our custom policies.

Upvotes: 2

Views: 1144

Answers (1)

Shui shengbao
Shui shengbao

Reputation: 19195

The following template will work for you.

{
    "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "name": {
            "type": "string",
            "defaultValue": "shuitest4"
        },
        "type": {
            "type": "string",
            "defaultValue": "other"
        },
        "hockeyAppToken": {
            "type": "string",
            "defaultValue": ""
        },
        "hockeyAppId": {
            "type": "string",
            "defaultValue": ""
        },
        "regionId": {
            "type": "string",
            "defaultValue": "southcentralus"
        },
        "requestSource": {
            "type": "string",
            "defaultValue": "IbizaAIExtension"
        }
    },
    "resources": [
        {
            "name": "[parameters('name')]",
            "type": "microsoft.insights/components",
            "location": "[parameters('regionId')]",
            "apiVersion": "2014-08-01",
            "properties": {
                "ApplicationId": "[parameters('name')]",
                "Application_Type": "[parameters('type')]",
                "HockeyAppToken": "[parameters('hockeyAppToken')]",
                "HockeyAppId": "[parameters('hockeyAppId')]",
                "Flow_Type": "Redfield",
                "Request_Source": "[parameters('requestSource')]"
            }
        }
    ]
}

There is a easy way for you to get the template. You could create the resource on Azure Portal, when you click Automation options, you will get the template.

enter image description here

Upvotes: 2

Related Questions