简体   繁体   English

将警报规则添加到Azure云服务时出错

[英]Error adding Alert Rule to Azure Cloud Service

I've created a script to add alert rules to several Azure resources (web apps, SQL databases, and cloud services). 我已经创建了一个脚本来向几个Azure资源(Web应用程序,SQL数据库和云服务)添加警报规则。 Everything works except for creating the cloud service alerts which returns an error: 除了创建返回错误的云服务警报外,一切正常:

Add-AlertRule : ResourceProviderNotSupported: The resource provider 'Microsoft.ClassicCompute' is not supported. Add-AlertRule:ResourceProviderNotSupported:不支持资源提供程序“Microsoft.ClassicCompute”。

This is the script I'm using to add the rule: 这是我用来添加规则的脚本:

$cloudServices = Get-AzureResource -ResourceType "Microsoft.ClassicCompute/domainNames" -ResourceGroupName $resourceGroup

Foreach ($cloudService in $cloudServices)
{
    # Cloud Service - CPU Percentage
    Add-AlertRule `
      -RuleType Metric `
      -Name "CPU Percentage (Cloud Service)" `
      -Location $cloudService.Location `
      -ResourceGroup $cloudService.ResourceGroupName `
      -Operator GreaterThan `
      -Threshold 75 `
      -WindowSize 01:00:00 `
      -ResourceId $cloudService.ResourceId `
      -MetricName "Percentage CPU" `
      -TimeAggregationOperator Average `
      -SendToServiceOwners
}

I've tried other using a different ResourceType parameter to target the role instead of the cloud service, but that doesn't work either. 我尝试过使用不同的ResourceType参数来定位角色而不是云服务,但这也不起作用。

Has anyone had any experience scripting these cloud service alerts successfully? 有没有人有成功编写这些云服务警报的经验?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 PowerShell 在 Azure 中创建新的警报规则? - How to create a new alert rule in Azure using PowerShell? 使用 PowerShell 中的 Get-AzMetric 从 Azure 经典云服务中获取“CpuPercentage”指标返回错误 - Using Get-AzMetric from PowerShell to get “CpuPercentage” metrics from Azure Classic Cloud service returns error 创建 Azure 部署 Package 并部署到云服务 - Create Azure Deployment Package & deploy to cloud service 启动任务未在Azure云服务角色上运行 - Startup Task not running on Azure Cloud Service role 需要重新启动的Azure云服务启动任务 - Azure Cloud Service Startup Task that requires reboot Microsoft Azure 在任何服务主体过期时发出邮件警报 - Microsoft Azure alert to mail when any service principal getting expired 将员工 ID 添加到 azure AD 中的声明中,Add-AzureADServicePrincipalPolicy 给出的服务主体 ID 不存在错误 - Adding employee id to claims in azure AD, Add-AzureADServicePrincipalPolicy is giving does not exist error for service principal id 将备份管理服务添加到Azure Powershell中的Keyvault - Adding the backup management service to keyvault in Azure powershell 如何在Azure云服务上使用第三方DLL - How to use 3rd party DLL on Azure Cloud Service 如何使用 Powershell 7 将保留的 IP 地址分配给 Azure 上的云服务? - How to assign a reserved IP address to a cloud service on Azure using Powershell 7?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM