Sunday, March 22, 2020

Generating Azure Application Insight Key in Azure DevOps pipeline

If you want to generate an Application Insights key in your Azure DevOps pipeline - you can use the the PowerShell code snippet below in a Azure PowerShell task.


Look at Automate Azure Application Insight resources using PowerShell and New-AzureRmApplicationInsightsKeyApiKey for more details.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Install-Module AzureRM.ApplicationInsights -force -verbose -scope CurrentUser
Import-Module AzureRM.ApplicationInsights

$resourcegroupname ='rg_func****'
$aicomponentname ='func****'
$permissions = @("ReadTelemetry", "WriteAnnotations")
$apikeydescription = 'testapikey'

New-AzureRmApplicationInsightsApiKey -ResourceGroupName $resourcegroupname 
-Name $aicomponentname -Description $apikeydescription -Permissions $permissions

No comments:

Post a Comment