Reputation: 1293
I can create an api management instance
az apim create \
--name "$apimName" \
--resource-group "$resourceGroupName" \
--publisher-name 'Publisher' \
--publisher-email '[email protected]' \
--tags "${resourceTags[@]}"
and I can create an app insights instance
az monitor app-insights component create \
--app "${apimName}-appins" \
--location "australiaeast" \
--resource-group "$resourceGroupName" \
--tags "${resourceTags[@]}"
How do I attach the api insights to api management?
Upvotes: 1
Views: 420
Reputation: 42053
Try the command below, replace the values with yours.
az resource create --resource-type 'Microsoft.ApiManagement/service/loggers' -g '<apim-group-name>' -n '<apim-name>/loggers/<appinsight-name>' --properties '{
"loggerType":"applicationInsights",
"description": null,
"credentials": {
"instrumentationKey": "<Instrumentation-Key-of-your-appinsight>"
},
"isBuffered": true,
"resourceId": "/subscriptions/<subscription-id>/resourceGroups/<appinsight-group-name>/providers/microsoft.insights/components/<appinsight-name>"
}'
Upvotes: 3