私はARMを学ぶことを試みてきましたが、私は同じエラーに悩まされ続けています。私は実際に私が間違っていることを得ることはできません。誰かがここで私を助けて、私が間違ってやっていることとそれを修正する方法を教えてもらえますか?ARMテンプレートalertRulesエラー:TargetResourceNotFound
私が間違って何が起こっているかを推測する場合はここに私のエラー
Template deployment returned the following errors:
11:05:16 - 11:05:15 - Resource Microsoft.Insights/alertRules 'cpu_percent' failed with message '{
11:05:16 - "code": "TargetResourceNotFound",
11:05:16 - "message": "Exception of type 'Microsoft.WindowsAzure.Management.Monitoring.MonitoringServiceException' was thrown."
11:05:16 - Deploying template using PowerShell script failed.
11:05:16 - Tell us about your experience at https://go.microsoft.com/fwlink/?LinkId=691202
11:05:16 - }'
11:05:16 - 11:05:15 - Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
11:05:16 - 11:05:15 - Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
11:05:16 -
11:05:16 -
そしてここでは私のコード
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sendToServiceOwners": {
"type": "bool",
"defaultValue": true,
"metadata": {
"description": "Specifies if alerts are sent to service owners"
}
},
"windowSize": {
"type": "string",
"defaultValue": "00:05:00",
"metadata": {
"description": "Period of time to monitor for"
}
},
"aggregation": {
"type": "string",
"defaultValue": "Average",
"allowedValues": [
"Average",
"Last",
"Maximum",
"Minimum",
"Total"
],
"metadata": {
"description": "The way collected data should be compared"
}
},
"threshold": {
"type": "string",
"defaultValue": "80",
"metadata": {
"description": "The treshold value at which the alert will trigger"
}
},
"operator": {
"type": "string",
"defaultValue": "GreaterThan",
"allowedValues": [
"GreaterThan",
"GreaterThanOrEqual",
"LessThan",
"LessThanOrEqual"
],
"metadata": {
"description": "Different sorts of operators for comparing the value"
}
},
"metricName": {
"type": "string",
"defaultValue": "cpu_percent",
"metadata": {
"description": "Name of the specific Metric"
}
},
"resourceId": {
"type": "string",
"defaultValue": "[resourceId('Microsoft.Sql/servers', parameters('serverName'))]",
"metadata": {
"description": "Resource ID"
}
},
"isEnabled": {
"type": "bool",
"defaultValue": true,
"metadata": {
"description": "Specifying if alert is enabled"
}
},
"alertDescription": {
"type": "string",
"defaultValue": "Alert used for Checking CPU for 80% Spikes"
},
"alertName": {
"type": "string",
"defaultValue": "cpu_percent"
},
"ugentecdbtestName": {
"type": "string",
"minLength": 1
},
"serverNameAdminLogin": {
"type": "string",
"minLength": 1,
"defaultValue": "*********"
},
"serverNameAdminLoginPassword": {
"defaultValue": ********,
"minLength": 1,
"type": "securestring"
},
"ugentecdbtestCollation": {
"type": "string",
"minLength": 1,
"defaultValue": "SQL_Latin1_General_CP1_CI_AS"
},
"ugentecdbtestEdition": {
"type": "string",
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"Standard",
"Premium"
]
},
"ugentecdbtestRequestedServiceObjectiveName": {
"type": "string",
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"S0",
"S1",
"S2",
"P1",
"P2",
"P3"
],
"metadata": {
"description": "Describes the performance level for Edition"
}
},
"serverName": {
"type": "string",
"defaultValue": "ugentecserver"
}
},
"variables": {
},
"resources": [
{
"name": "[parameters('serverName')]",
"type": "Microsoft.Sql/servers",
"location": "West Europe",
"apiVersion": "2014-04-01-preview",
"properties": {
"administratorLogin": "[parameters('serverNameAdminLogin')]",
"administratorLoginPassword": "[parameters('serverNameAdminLoginPassword')]",
"version": "12.0"
}
},
{
"name": "[concat(parameters('serverName'), '/', parameters('ugentecdbtestName'))]",
"type": "Microsoft.Sql/servers/databases",
"location": "westeurope",
"apiVersion": "2014-04-01-preview",
"dependsOn": [ "[resourceId('Microsoft.Sql/servers', parameters('serverName'))]" ],
"properties": {
"collation": "[parameters('ugentecdbtestCollation')]",
"edition": "[parameters('ugentecdbtestEdition')]",
"maxSizeBytes": "1073741824",
"requestedServiceObjectiveName": "[parameters('ugentecdbtestRequestedServiceObjectiveName')]"
}
},
{
"type": "Microsoft.Insights/alertRules",
"name": "[parameters('alertName')]",
"dependsOn": ["[resourceId('Microsoft.Sql/servers/databases', parameters('serverName'),parameters('ugentecdbtestName'))]"],
"location": "West Europe",
"apiVersion": "2016-03-01",
"properties": {
"name": "[parameters('alertName')]",
"description": "[parameters('alertDescription')]",
"isEnabled": "[parameters('isEnabled')]",
"condition": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
"dataSource": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri": "[parameters('resourceId')]",
"metricName": "[parameters('metricName')]",
"operator": "[parameters('aggregation')]"
},
"threshold": "[parameters('threshold')]",
"windowSize": "[parameters('windowSize')]",
"timeAggregation": "[parameters('aggregation')]"
},
"actions": [
{
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
"sendToServiceOwners": "[parameters('sendToServiceOwners')]"
}
]
}
}
],
"outputs": {
"testOutput": {
"type": "string",
"value": "test123"
},
"DbAdoConnString": {
"type": "string",
"value": "[concat('Server=tcp:',reference(parameters('serverName')).fullyQualifiedDomainName,',1433;Initial Catalog=',parameters('ugentecdbtestName'),';Persist Security Info=False;User ID=',reference(parameters('serverName')).administratorLogin,';Password=',reference(parameters('serverName')).administratorLoginPassword,';MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;')]"
}
}
}
この答えとして必要なのparamsの値を更新する必要は全く正しくありませんレベルはあなたのコメントのために – juvchan
@ juvchan thxが動作しません、答えを更新しました。 – Peter