2016-02-23 11 views
6

ネストされたテンプレートのセットの一部であるAzure Resource Managerテンプレートがあります。 App Insightコンポーネント、禁止された要求のWebサイトに対する警告ルール、多段階Webテスト、Webテストに対する警告ルールが作成されます。 Webテストに対するアラートルールを除くすべてのリソースが正常にデプロイされます。私はポータルに入り、デプロイメントが失敗した後で問題なしにテストに対してアラートを作成することができます。ARMテンプレートwebtestの警告がResourceNotFoundで失敗する

{ 
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
"contentVersion": "1.0.0.0", 
"parameters": { 
    "company": { 
     "type": "string" 
    }, 
    "region": { 
     "type": "string" 
    }, 
    "retailerAPIKey": { 
     "type": "string" 
    }, 
    "deviceID": { 
     "type": "string" 
    }, 
    "lumicastVersion": { 
     "type": "string" 
    } 
}, 
"variables": { 
    "frameworkWebSite": "[concat(parameters('company'),'-BLS-FRAMEWORK-',parameters('region'))]" 
}, 
"resources": [ 
    { 
     "name": "[concat('ForbiddenRequests ', variables('frameworkWebSite'))]", 
     "type": "Microsoft.Insights/alertrules", 
     "location": "[parameters('region')]", 
     "apiVersion": "2014-04-01", 
     "tags": { 
      "displayName": "ForbiddenRequests frameworkWebSite" 
     }, 
     "properties": { 
      "name": "[concat('ForbiddenRequests ', variables('frameworkWebSite'))]", 
      "description": "[concat(variables('frameworkWebSite'), ' has some requests that are forbidden, status code 403.')]", 
      "isEnabled": false, 
      "condition": { 
       "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", 
       "dataSource": { 
        "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", 
        "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', variables('frameworkWebSite'))]", 
        "metricName": "Http403" 
       }, 
       "operator": "GreaterThan", 
       "threshold": 0, 
       "windowSize": "PT5M" 
      }, 
      "action": { 
       "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", 
       "sendToServiceOwners": true, 
       "customEmails": [ ] 
      } 
     } 
    }, 
    { 
     "name": "[variables('frameworkWebSite')]", 
     "type": "Microsoft.Insights/components", 
     "location": "Central US", 
     "apiVersion": "2014-04-01", 
     "tags": { 
      "displayName": "Component frameworkWebSite", 
      "[concat('hidden-link:',resourceGroup().id,'/providers/Microsoft.Web/sites/',variables('frameworkWebSite'))]": "Resource" 
     }, 
     "properties": { 
      "applicationId": "[variables('frameworkWebSite')]" 
     } 
    }, 
    { 
     "name": "[concat('siteinit-', variables('frameworkWebSite'))]", 
     "apiVersion": "2015-05-01", 
     "type": "Microsoft.Insights/webtests", 
     "location": "Central US", 
     "tags": { 
      "displayName": "WebtestL ABL BSL Init frameworkWebSite", 
      "[concat('hidden-link:', resourceId('microsoft.insights/components/', variables('frameworkWebSite')))]": "Resource" 
     }, 
     "dependsOn": [ 
      "[concat('microsoft.insights/components/', variables('frameworkWebSite'))]" 
     ], 
     "properties": { 
      "Name": "[concat('GETBytelightInit-',parameters('region'))]", 
      "Description": "[concat('GETBytelightInit-',parameters('region'),'.webtest')]", 
      "Enabled": true, 
      "Frequency": 600, 
      "Timeout": 120, 
      "Kind": "multistep", 
      "Locations": [ 
       { "Id": "us-il-ch1-azr" }, 
       { "Id": "us-ca-sjc-azr" }, 
       { "Id": "us-tx-sn1-azr" } 
      ], 
      "Configuration": { 
       "WebTest": "[concat('<workingwebtest goes here>','<ends here>')]" 
      }, 
      "SyntheticMonitorId": "[concat('siteinit-', variables('frameworkWebSite'))]" 
     } 
    }, 
    { 
     "name": "[concat('siteinit-', variables('frameworkWebSite'), '-alert')]", 
     "type": "Microsoft.Insights/alertrules", 
     "apiVersion": "2015-04-01", 
     "location": "[parameters('region')]", 
     "tags": { 
      "displayName": "Alert webtest site Init frameworkWebSite", 
      "[concat('hidden-link:', resourceId('microsoft.insights/components/', variables('frameworkWebSite')))]": "Resource", 
      "[concat('hidden-link:', resourceId('microsoft.insights/webtests/', concat('siteinit-', variables('frameworkWebSite'))))]": "Resource" 
     }, 
     "dependsOn": [ 
      "[concat('microsoft.insights/components/', variables('frameworkWebSite'))]", 
      "[concat('microsoft.insights/webtests/siteinit-', variables('frameworkWebSite'))]" 
     ], 
     "properties": { 
      "name": "[concat('siteinit-', variables('frameworkWebSite'), '-alert')]", 
      "description": "Alert for site Initialize", 
      "isEnabled": true, 
      "condition": { 
       "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.LocationThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client", 
       "odata.type": "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition", 
       "dataSource": { 
        "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client", 
        "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", 
        "resourceUri": "[resourceId('microsoft.insights/webtests/', concat('siteinit-', variables('frameworkWebSite')))]", 
        "metricName": "GSMT_AvRaW" 
       }, 
       "windowSize": "PT15M", 
       "failedLocationCount": 2 
      }, 
      "action": { 
       "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, Microsoft.WindowsAzure.Management.Mon.Client", 
       "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", 
       "sendToServiceOwners": true, 
       "customEmails": [ ] 
      } 
     } 
    } 

], 
"outputs": { 
    "TestLink": { 
     "type": "string", 
     "value": "[resourceId('microsoft.insights/webtests/', concat('siteinit-', variables('frameworkWebSite')))]" 
    } 
} 

}

展開はして失敗します。

"statusMessage": { 
    "Code": "ResourceNotFound", 
    "Message": "Exception of type 'Microsoft.WindowsAzure.Management.Monitoring.MonitoringServiceException' was thrown." 
}, 

これは、このテンプレートに行くと、各展開はサイトの2つのコピーを持っています多くのテストのちょうど最初のものです。したがって、手動アラートルールの作成はオプションではありません。

"resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', variables('frameworkWebSite'))]", 

はRESOURCEID()関数でそれを試してみる:

​​

resourceId() reference hereを参照してください

答えて

0

私はあなたのresourceUriに問題があると思います。

これが役に立ちます。

関連する問題