Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.69k stars 5.11k forks source link

[FEATURE REQ] Event System topic misses Monitor Alert/Action group as destination. #31313

Open atombrella opened 3 weeks ago

atombrella commented 3 weeks ago

API Spec link

https://learn.microsoft.com/en-us/rest/api/eventgrid/controlplane/system-topic-event-subscriptions/create-or-update?view=rest-eventgrid-controlplane-2022-06-15&tabs=HTTP

API Spec version

2024-06-01-preview, 2022-06-15

Please describe the feature.

It is not possible to set "monitor alert" for the system topic event types. The event data can be forwarded to an event hub, storage queue etc. However, the monitor alert (or action group) is missing from this list.

https://learn.microsoft.com/en-us/rest/api/eventgrid/controlplane/system-topic-event-subscriptions/create-or-update?view=rest-eventgrid-controlplane-2022-06-15&tabs=HTTP

I'm not really sure if the link for "API Spec link" is the right one. Please correct it in case it is incorrect.

There is an active issue in the Terraform provider which has many 👍 https://github.com/hashicorp/terraform-provider-azurerm/issues/24873

hpias commented 2 weeks ago

It looks like this is not true (anymore?):

Example for Microsoft.KeyVault system topic

subscription_id=...
resource_group_id=...
system_topic_name=...
action_group_name=...
subscription_name="testsub1"

url_base="https://management.azure.com/subscriptions/$subscription_id/resourceGroups/$resource_group/providers/Microsoft.EventGrid/systemTopics/$system_topic_name/eventSubscriptions/"
api_version="2024-06-01-preview"
url="$url_base/$subscription_name?api-version=$api_version"
action_group_resource_name="/subscriptions/$subscription_id/resourceGroups/$resource_group/providers/Microsoft.Insights/actionGroups/$action_group_name"

body=$(cat << EOF
{
  "properties": {
    "destination": {
      "endpointType": "MonitorAlert",
      "properties": {
        "actionGroups": [ "$action_group_resource_name" ],
        "description": "Sample description",
        "severity": "Sev2"
      }
    },
    "eventDeliverySchema": "CloudEventSchemaV1_0",
    "filter": {
    "includedEventTypes": [ 
        "Microsoft.KeyVault.SecretNearExpiry" 
      ]
    }
  }
}
EOF
)

az rest --method put --url "$url" --body $body

BUT the terraform resource is still missing this... https://registry.terraform.io/providers/hashicorp/azurerm/4.8.0/docs/resources/eventgrid_system_topic_event_subscription