I have tried to reproduce Hugh Woods experiment (https://medium.com/asos-techblog/sending-messages-from-azure-data-factory-to-service-bus-86d4be6dd357) in my azure environment to sent messages from Azure DataFactory to Azure Service Bus.
I have followed the instructions, assigning the "Azure Service Bus Data Sender" role to my data factory’s managed identity.
But when I tried to sent a message to Service Bus I got this error:
Error code : 2108
Failure type : User configuration issue
Details : Invoking Web Activity failed with HttpStatusCode -
'401 : Unauthorized', message - ''
Source : Pipeline Service Bus REST API
What am I doing wrong in this case? I have this configuration in my pipeline:
{
"name": "Service Bus REST API",
"properties": {
"activities": [
{
"name": "Service Bus REST API",
"description": "Teste",
"type": "WebActivity",
"dependsOn": [],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"url": "https://sb-namespace-dv.servicebus.windows.net/sbt-azure-adf-ntt-data-test/messages",
"method": "POST",
"headers": {
"CustomHeader-Version": "\"1.0\"",
"Content-Type": "application/json",
"BrokerProperties": {
"value": "#concat('{\"CorrelationId\": \"',pipeline().RunId,'\"}')",
"type": "Expression"
}
},
"body": {
"value": "{\"message\":{\"value\":\"#variables('OutputDetails')\",\"type\":\"Expression\"}}",
"type": "Expression"
},
"httpRequestTimeout": "00:10:00",
"authentication": {
"type": "MSI",
"resource": "https://servicebus.azure.net"
}
}
}
],
"folder": {
"name": "999_Others/9910_DevTest/TesteServiceBusADF"
},
"annotations": []
}
}
I have followed all steps of Hugh Woods article. I have expecting to get the same results of his experiment (below), but I did not have success.
{
message : "Snapshot Avaliable"
}
The message you are getting is HTTP 401 Unauthorized. So the call to write data to the service bus is being refused.
There are 2 possibilities:
The authentication is not set up correctly
You tested it before the role assignments had propagated (can take 5 mins)
See: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-managed-service-identity
I am having an issue where I cannot create KBs in QnA Maker for services which I have deployed via ARM template/DevOps. There are a number of issues here and on Github, but the main suggestions (create all the resources in the same region, don't put anything else on the app service plan, delete and redeploy) have not worked for me. As noted the resources HAVE been created and deleted multiple times with the same names, so I don't know if that's part of the issue. The resources create just fine (cognitive service, app service, app service plan, azure search, and app insights), all in WestUS, but then I am unable to create a knowledge base either through the API or directly at qnamaker.ai. In both cases I get the error message:
No Endpoint keys found.
I can get the keys through Azure CLI, plus they are showing in the portal, so that's not the issue. It may perhaps be an issue with the Authorization EndpointKey which is generated/shown after publishing a new KB, but as I cannot create or publish one, I cannot find this key. Not sure if that is the key the error message is referring to.
Here is the ARM template I am using the set up the resources.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sites_etn_qnamaker_name": {
"defaultValue": "etn-qnamaker",
"type": "string"
},
"serverfarms_etn_qnamaker_name": {
"defaultValue": "etn-qnamaker",
"type": "string"
},
"components_etn_qnamaker_ai_name": {
"defaultValue": "etn-qnamaker-ai",
"type": "string"
},
"accounts_etn_qnamaker_name": {
"defaultValue": "etn-qnamaker",
"type": "string"
},
"searchServices_etnqnamaker_azsearch_name": {
"defaultValue": "etnqnamaker-azsearch",
"type": "string"
},
"smartdetectoralertrules_failure_anomalies___etn_qnamaker_ai_name": {
"defaultValue": "failure anomalies - etn-qnamaker-ai",
"type": "string"
},
"actiongroups_application_20insights_20smart_20detection_externalid": {
"defaultValue": "/subscriptions/REDACTED/resourceGroups/avcnc-chatbot-rg/providers/microsoft.insights/actiongroups/application%20insights%20smart%20detection",
"type": "string"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.CognitiveServices/accounts",
"apiVersion": "2017-04-18",
"name": "[parameters('accounts_etn_qnamaker_name')]",
"location": "westus",
"sku": {
"name": "S0"
},
"kind": "QnAMaker",
"properties": {
"apiProperties": {
"qnaRuntimeEndpoint": "[concat('https://', parameters('accounts_etn_qnamaker_name'), '.azurewebsites.net')]"
},
"customSubDomainName": "[parameters('accounts_etn_qnamaker_name')]"
}
},
{
"type": "Microsoft.Insights/components",
"apiVersion": "2015-05-01",
"name": "[parameters('components_etn_qnamaker_ai_name')]",
"location": "westus",
"tags": {
"hidden-link:/subscriptions/REDACTED/resourceGroups/ENTP-Chatbot-rg/providers/Microsoft.Web/sites/etn-qnamaker": "Resource"
},
"kind": "web",
"properties": {
"Application_Type": "web"
}
},
{
"type": "Microsoft.Search/searchServices",
"apiVersion": "2015-08-19",
"name": "[parameters('searchServices_etnqnamaker_azsearch_name')]",
"location": "West US",
"sku": {
"name": "basic"
},
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"hostingMode": "default"
}
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"name": "[parameters('serverfarms_etn_qnamaker_name')]",
"location": "West US",
"sku": {
"name": "S1",
"tier": "Standard",
"size": "S1",
"family": "S",
"capacity": 1
},
"kind": "app",
"properties": {
"perSiteScaling": false,
"maximumElasticWorkerCount": 1,
"isSpot": false,
"reserved": false,
"isXenon": false,
"hyperV": false,
"targetWorkerCount": 0,
"targetWorkerSizeId": 0
}
},
{
"type": "microsoft.alertsmanagement/smartdetectoralertrules",
"apiVersion": "2019-06-01",
"name": "[parameters('smartdetectoralertrules_failure_anomalies___etn_qnamaker_ai_name')]",
"location": "global",
"dependsOn": [
"[resourceId('microsoft.insights/components', parameters('components_etn_qnamaker_ai_name'))]"
],
"properties": {
"description": "Failure Anomalies notifies you of an unusual rise in the rate of failed HTTP requests or dependency calls.",
"state": "Enabled",
"severity": "Sev3",
"frequency": "PT1M",
"detector": {
"id": "FailureAnomaliesDetector",
"name": "Failure Anomalies",
"description": "Detects if your application experiences an abnormal rise in the rate of HTTP requests or dependency calls that are reported as failed. The anomaly detection uses machine learning algorithms and occurs in near real time, therefore there's no need to define a frequency for this signal.<br/></br/>To help you triage and diagnose the problem, an analysis of the characteristics of the failures and related telemetry is provided with the detection. This feature works for any app, hosted in the cloud or on your own servers, that generates request or dependency telemetry - for example, if you have a worker role that calls <a class=\"ext-smartDetecor-link\" href=\\\"https://learn.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#trackrequest\\\" target=\\\"_blank\\\">TrackRequest()</a> or <a class=\"ext-smartDetecor-link\" href=\\\"https://learn.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#trackdependency\\\" target=\\\"_blank\\\">TrackDependency()</a>.",
"supportedResourceTypes": [
"ApplicationInsights"
],
"imagePaths": [
"https://globalsmartdetectors.blob.core.windows.net/detectors/FailureAnomaliesDetector/v0.18/FailureAnomaly.png"
]
},
"scope": [
"[resourceId('microsoft.insights/components', parameters('components_etn_qnamaker_ai_name'))]"
],
"actionGroups": {
"groupIds": [
"[parameters('actiongroups_application_20insights_20smart_20detection_externalid')]"
]
}
}
},
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[parameters('sites_etn_qnamaker_name')]",
"location": "West US",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_etn_qnamaker_name'))]"
],
"tags": {
"hidden-related:/subscriptions/REDACTED/resourcegroups/ENTP-Chatbot-rg/providers/Microsoft.Web/serverfarms/etn-qnamaker": "empty"
},
"kind": "app",
"properties": {
"enabled": true,
"hostNameSslStates": [
{
"name": "[concat(parameters('sites_etn_qnamaker_name'), '.azurewebsites.net')]",
"sslState": "Disabled",
"hostType": "Standard"
},
{
"name": "[concat(parameters('sites_etn_qnamaker_name'), '.scm.azurewebsites.net')]",
"sslState": "Disabled",
"hostType": "Repository"
}
],
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_etn_qnamaker_name'))]",
"reserved": false,
"isXenon": false,
"hyperV": false,
"scmSiteAlsoStopped": false,
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"hostNamesDisabled": false,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"httpsOnly": false,
"redundancyMode": "None"
}
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('sites_etn_qnamaker_name'), '/web')]",
"location": "West US",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('sites_etn_qnamaker_name'))]"
],
"tags": {
"hidden-related:/subscriptions/REDACTED/resourcegroups/ENTP-Chatbot-rg/providers/Microsoft.Web/serverfarms/etn-qnamaker": "empty"
},
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php",
"hostingstart.html"
],
"netFrameworkVersion": "v4.0",
"phpVersion": "5.6",
"requestTracingEnabled": false,
"remoteDebuggingEnabled": false,
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "[concat('$',parameters('sites_etn_qnamaker_name'))]",
"scmType": "None",
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": false,
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"experiments": {
"rampUpRules": []
},
"autoHealEnabled": false,
"cors": {
"allowedOrigins": [
"*"
],
"supportCredentials": false
},
"localMySqlEnabled": false,
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"ftpsState": "AllAllowed",
"reservedInstanceCount": 0
}
},
{
"type": "Microsoft.Web/sites/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('sites_etn_qnamaker_name'), '/', parameters('sites_etn_qnamaker_name'), '.azurewebsites.net')]",
"location": "West US",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('sites_etn_qnamaker_name'))]"
],
"properties": {
"siteName": "[parameters('sites_etn_qnamaker_name')]",
"hostNameType": "Verified"
}
}
]
}
Here are just a few of the sites I checked
https://github.com/MicrosoftDocs/azure-docs/issues/44719
https://github.com/MicrosoftDocs/azure-docs/issues/40089
Unable to create knowledgebase for azure cognitive service (Error: "No Endpoint keys found.")
EDIT: KB creation fails both through qnamaker.ai and via API. On qnamaker.ai, I get this message when trying to create a KB:
And here is the PowerShell script I was using to try and create it programmatically:
$body = Get-Content '$(System.DefaultWorkingDirectory)/_AveryCreek_OEM_CSC_Bot/models/qnamaker/Avery_Creek_Commercial_QnA.json' | Out-String
$header = #{
"Content-Type"="application/json"
"Ocp-Apim-Subscription-Key"="$(QNA_KEY)"
}
Invoke-RestMethod -Uri "https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/create" -Method 'Post' -Body $body -Headers $header
Searching for issues with endpoint keys and qnamaker turns up a fair few results.
I've just closed a case with Azure support for the same issue, and here are some of the steps we checked on the way to fixing this, hopefully one of these will be useful for anyone having this issue in the future as the error message doesn't give you much to go on:
First, check the troubleshooting FAQ https://learn.microsoft.com/en-us/azure/cognitive-services/qnamaker/troubleshooting. There's nothing on the endpoint keys issue, but when you hit something else it's a good starting point.
All services - check your naming. For example, for me my search service was named differently than the rest of my config was expecting, and also my cognitive services runtime endpoint in the api-properties was incorrect. Still deployed though - you won't always get an error on the service itself if you provide incorrect names to later created services, you'll just fail at the point of creating your KBs.
All services - check your SKUs. While there's no problem that I could find being on free/basic, you can only have 1 qna cognitive service on a free subscription, so you'll need to tear down and recreate or update as you go.
QnA cognitive service - config settings (keys and values) are case-sensitive.
Qna web app and web app plan - check your quotas haven't been hit, particularly memory and CPU.
QnA Web App - You should be able to go the https://{endpoint}/qnamaker/corehealthstatus and see a positive json response like this (or if there's an initException, you've at least got another error to go on):
{"processId":4920,"runtimeVersion":"5.46.0","initException":"","startupTime":"10/28/2020 2:44:39 PM"}
Qna Web App - You should also be able to go the https://{endpoint}/qnamaker/proxyhealthstatus and see a positive json response like this.:
{
"coreVersion": "5.46.0",
"coreProcessId": 4920,
"coreUrl": "http://localhost:50061"
}
Qna Web App - Don't try to create a KB, whether through the qnamaker portal or dynamically, if your app doesn't show similar successes on those two check endpoints - build a wait if need be. You'll almost certainly see the endpoint errors via the API if you hit it immediately.
For the check endpoints above, the endpoint is visible in the overview section of your web app in the portal, and usually is the name of your app e.g. https://example-app-qnamaker-webapp.azurewebsites.net/qnamaker/corehealthstatus if the app was called example-app-qnamaker-webapp. In my own creation scripts, I checked against coreProcessId > 0 and startupTime is a valid date to indicate service readiness before creating a KB.
EDIT: I'd also add that if it takes a long time to deploy, part of your config is probably wrong. Every time I've had things work correctly, it's been a rapid deployment (and that goes for the services, knowledge bases, and calls to both az cli and the qnamaker REST api).
I suspect you may have been downvoted because this looks an awful lot more like a bug report than a Stack Overflow question. From the first issue you linked:
We will go ahead and close this issue as this is a service level issue and the best way to report it if it occurs again is through the QnA portal from "General Enquiry through uservoice" option from the top right corner.
I'll try to answer you anyway. You say you've tried creating all the resources in the same region, but remember that resource groups have locations too. You should make sure the resource group is also in the same region according to the answer to the Stack Overflow question you linked to: Unable to create knowledgebase for azure cognitive service (Error: "No Endpoint keys found.")
It seems that there is sometimes the problem that the endpoint keys can only be found, if the Resource Group holding all resources for the QnA Maker Service (like App Service, Application Insights, Search Service and the Application Service Plan) is hosted in the same region as the QnA Maker Service itself.
I also see that you've tried not putting anything else on the app service plan, and you've tried deleting and redeploying. But you might also try just waiting a while, or retrying more persistently. From another GitHub issue:
These failures are intermittent, If I persistently retry a failure, the knowledgebase will often eventually get created.
And from this issue:
According to the QnA Maker team, this error is shown when the QnA Maker service has not finished provisioning. There appear to be service issues QnA Maker right now that are causing the provisioning process to take even longer than the time we wait in the script.
If you would like to raise an issue through UserVoice, I highly recommend posting it on the forum so that other people can see the problem and upvote it.
I am deploying an new metric alert to Azure with an ARM template.
I am following the exact same way of Microsoft doc.
With the only change that I deploy just 1 metric to an Automation account and not to an storage account
Template file
"variables": {
"criterion1": "[array(parameters('criterion1'))]",
"criteria": "[concat(variables('criterion1'))]"
},
"resources": [
{
"name": "[parameters('alertName')]",
"type": "Microsoft.Insights/metricAlerts",
"location": "global",
"apiVersion": "2018-03-01",
"tags": {},
"properties": {
"description": "[parameters('alertDescription')]",
"severity": "[parameters('alertSeverity')]",
"enabled": "[parameters('isEnabled')]",
"scopes": [
"[parameters('resourceId')]"
],
"evaluationFrequency": "[parameters('evaluationFrequency')]",
"windowSize": "[parameters('windowSize')]",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
"allOf": "[variables('criteria')]"
},
"actions": [
{}
]
}
}
]
parameter file
"criterion1": {
"value": {
"name": "1st criterion",
"metricName": "TotalJob",
"dimensions": [
{
"name": "Status",
"operator": "Include",
"values": [
"Failed"
]
},
{
"name": "Status",
"operator": "Include",
"values": [
"Completed"
]
}
],
"operator": "GreaterThan",
"threshold": "5",
"timeAggregation": "Total"
}
}
But when i deploy this to Azure my Powershell command get stuck without giving any errors even with -DeploymentDebugLogLevel All parameter on it. In Azure portal I got the error "Internal server error" without any context. The json log gives me following logs:
{
"authorization": {
"action": "Microsoft.Insights/metricAlerts/write",
"scope": "/subscriptions/xxxxxx/resourcegroups/bilalachahbar/providers/Microsoft.Insights/metricAlerts/New Metric Alert"
},
"caller": "xxxx",
"channels": "Operation",
"claims": {
"aud": "https://management.azure.com/",
"iss": "https://sts.windows.net/17b5a1d-057c-4ac-a15a-08758f7a7064/",
"iat": "15596014",
"nbf": "15596014",
"exp": "15599914",
"aio": "42RgYDgypS7rfe/Of0l1R+q3TbCgA=",
"appid": "0e4a093a-c6fd-4fba-b4e5-f07ba479f203",
"appidacr": "1",
"http://schemas.microsoft.com/identity/claims/identityprovider": "https://sts.windows.net/17xxxxxc5-a15a-08758f7a7064/",
"http://schemas.microsoft.com/identity/claims/objectidentifier": "a3db39bf-8c65-4b84-b049-d7af99bfb3e",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "a3db39bf-8c65-4b84-b049-d7af99bfb3e",
"http://schemas.microsoft.com/identity/claims/tenantid": "1xxxxxx057c-4ac5-a15a-087f7a7064",
"uti": "SCkIk235EScz0Hst20AA",
"ver": "1.0"
},
"correlationId": "8013b5-9788-41ed-afcf-0dbd8276349c",
"description": "",
"eventDataId": "e39509-0837-4435-af7a-02ba1462055f",
"eventName": {
"value": "EndRequest",
"localizedValue": "End request"
},
"category": {
"value": "Administrative",
"localizedValue": "Administrative"
},
"eventTimestamp": "2018-12-27T14:11:48.1462445Z",
"id": "/subscriptions/xxxxx/resourcegroups/xxxxxx/providers/Microsoft.Insights/metricAlerts/New+Metric+Alert/events/e39509-0837-4435-af7a-02ba1462055f/ticks/815167081462445",
"level": "Error",
"operationId": "e390389-ecc1-4a2-8c2-d94ea635cb",
"operationName": {
"value": "Microsoft.Insights/metricAlerts/write",
"localizedValue": "Create or update metric alert"
},
"resourceGroupName": "xxxxx",
"resourceProviderName": {
"value": "Microsoft.Insights",
"localizedValue": "Microsoft Insights"
},
"resourceType": {
"value": "Microsoft.Insights/metricAlerts",
"localizedValue": "Microsoft.Insights/metricAlerts"
},
"resourceId": "/subscriptions/xxxxxx/resourcegroups/bilalachahbar/providers/Microsoft.Insights/metricAlerts/New Metric Alert",
"status": {
"value": "Failed",
"localizedValue": "Failed"
},
"subStatus": {
"value": "InternalServerError",
"localizedValue": "Internal Server Error (HTTP Status Code: 500)"
},
"submissionTimestamp": "2018-12-27T14:12:05.0719055Z",
"subscriptionId": "xxxxxx",
"properties": {
"statusCode": "InternalServerError",
"serviceRequestId": "8613b5-9788-41d-afcf-0dbd27639c",
"statusMessage": "{\"error\":{\"code\":\"InternalServerError\",\"message\":\"The server encountered an internal error, please retry. If the problem persists, contact support.\"}}"
},
"relatedEvents": []
}
An other stack overflow question got an sort of same question.
He got the problem when using an resource that is not supported anymore but I guess that is not the case with me because the official MS documentation is from september this year. I got the same issues when I use the exact same arm template that is provided in the documentation
I found my own error
Action groups are required when you want to deploy metric alerts.
As you can see in the documentation they provide an action ID, and I didn't. As I thought that it wasn't necessary it actually is.
I know this is obvious but unfortunately I did not saw this in the documentation or in the error. After some debugging and looking in the Resource Explorer I've noticed this.
SO future reader I hope this will solve your issue
One little feedback is that there is no depends on value ATM so I can not create an action group resource first in the same arm template
I'm working on deploying an application to Azure Gov Cloud Stage & Prod. On Dev & QA we use APIM connected to AppInsights to gather statistics and generate alerts, however, AppInsights is not available in Stage Gov Cloud.
Is there any official timeline for availability of Application Insights in Gov Cloud on Stage?
As a workaround we planned to create an Application Insights resource on Dev (say AI-dev) which would be associated with APIM in Stage (say APIM-stage).
However, when we want to do the association, we go to APIM-stage in Azure Portal and try to select an Application Insights resource - there is none available, the existing AppInsights resources in Dev and QA are not visible from the the APIM in Stage.
Is it possible to configure Stage in such a way they will be visible? If yes, then how? We are looking for any means to make this association - either manually or automatically with an API.
Is there any other workaround available to gather application/APIM request statistics for Stage/Prod deployments? The ultimate goal is to have request alerts (e.g. for bad requests) working for Stage/Prod.
Here is what we've found after investigation:
Microsoft says that the target date for having Application Insights in Gov Cloud on Stage is end of Q4 2018 - as of 10/11/2018.
2./3.
It is possible to associate Application Insights located in Dev (Commercial Cloud) with APIM located in Gov Cloud Stage in two ways - either using VSTS pipeline tasks or REST API. It turns out that Azure Portal GUI will still not show any association or show an invalid association after doing that but the end result is it's working.
Method 1 (tested and working)
VSTS task:
task: AzureResourceGroupDeployment#2
VSTS task template:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appinsights-name": {
"type": "string"
},
"instrumentation": {
"type": "string"
},
"apim-name": {
"type": "string"
},
"api-name": {
"type": "string"
}
},
"resources": [
{
"type": "Microsoft.ApiManagement/service/loggers",
"name": "[concat(parameters('apim-name'), '/', parameters('appinsights-name'))]",
"apiVersion": "2018-01-01",
"scale": null,
"properties": {
"loggerType": "applicationInsights",
"description": null,
"credentials": {
"instrumentationKey": "[parameters('instrumentation')]"
},
"isBuffered": true
}
},
{
"type": "Microsoft.ApiManagement/service/apis/diagnostics",
"name": "[concat(parameters('apim-name'), '/', parameters('api-name'), '/', 'applicationinsights')]",
"apiVersion": "2018-01-01",
"scale": null,
"properties": {
"enabled": true
}
},
{
"type": "Microsoft.ApiManagement/service/apis/diagnostics/loggers",
"name": "[concat(parameters('apim-name'), '/', parameters('api-name'), '/', 'applicationinsights', '/',parameters('appinsights-name'))]",
"apiVersion": "2018-01-01",
"scale": null,
"properties": {
"loggerType": "applicationInsights",
"description": null,
"credentials": {
"instrumentationKey": "[parameters('instrumentation')]"
},
"isBuffered": true,
"resourceId": "[parameters('appinsights-name')]"
},
"dependsOn": [
"[resourceId('Microsoft.ApiManagement/service/apis/diagnostics', parameters('apim-name'), parameters('api-name'), 'applicationinsights')]"
]
}
]
}
Method 2 (not tested)
PUT https://management.usgovcloudapi.net/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{apimServiceName}/loggers/applicationinsights?api-version=2018-01-01 HTTP/1.1
Authorization: Bearer
Content-Type: application/json
{
"properties": {
"loggerType": "applicationinsights",
"description": null,
"isBuffered": true,
"resourceId": null,
"credentials":{
"instrumentationKey":"<ApplicationInsights-InstrumentationKey>"
}
}
}
PUT https://management.usgovcloudapi.net/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{apimServiceName}/diagnostics/applicationinsights?api-version=2018-01-01 HTTP/1.1
Authorization: Bearer
Content-Type: application/json
{
"properties": {
"enabled": true
}
}
I'm trying to setup Application Insights to be attached against Function App, and few Web API's (Azure App Service).
Ideally we want the whole deployment process to be fully automated from VSTS Build and Release so we don't have to setup the resource from Azure Portal.
I've created the ARM template for it and managed to get it to create a new Azure resource of Application Insight, however it's not showing the other settings that I want (i.e. Alert Rules, Billing Type, and Daily Data Cap).
Is setting up Alert Rules currently available via ARM template? if so can someone please help and verify if the ARM template I've got :)?
{
"comments": "App Insight Alert Rule",
"type": "microsoft.insights/alertrules",
"name": "[parameters('AppInsights.AlertRuleName')]",
"apiVersion": "2014-04-01",
"location": "East US",
"tags": {
"[concat('hidden-link:/subscriptions/',subscription().subscriptionId,'/resourcegroups/',parameters('ResourceGroupName'),'/providers/microsoft.insights/components/',parameters('AppInsights.Name'))]": "Resource"
},
"properties": {
"name": "[parameters('AppInsights.AlertRuleName')]",
"description": "",
"isEnabled": true,
"condition": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
"dataSource": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri": "[resourceId('microsoft.insights/components', parameters('AppInsights.Name'))]",
"metricName": "requestFailed.count"
},
"threshold": 1,
"windowSize": "PT5M"
},
"action": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
"customEmails": "[array(parameters('AppInsights.AlertSubscriber'))]"
}
},
"dependsOn": [
"[resourceId('microsoft.insights/components', parameters('AppInsights.Name'))]"
]
},
{
"type": "microsoft.insights/components",
"kind": "web",
"name": "[parameters('AppInsights.Name')]",
"apiVersion": "2014-04-01",
"location": "eastus",
"tags": {},
"properties": {
"ApplicationId": "[parameters('AppInsights.Name')]"
},
"dependsOn": []
},
{
"name": "[variables('billingplan')]",
"type": "microsoft.insights/components/CurrentBillingFeatures",
"location": "East US",
"apiVersion": "2015-05-01",
"dependsOn": [
"[resourceId('microsoft.insights/components', parameters('AppInsights.Name'))]"
],
"properties": {
"CurrentBillingFeatures": "[variables('pricePlan')]",
"DataVolumeCap": {
"Cap": "[parameters('AppInsights.DailyQuota')]"
}
}
}
]
}
Thanks
Harris
I've finally found out that the issue was due to me having same Alert Rule names (wasn't aware that alert rules are treated as resource and need to have unique names..).
So I ended up renaming the alert to something different, redeployed the solution and it finally creates the alert rules :).