Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3k forks source link

Managed HSM - Diagnostic settings - event hub - AZ cli #24425

Open peni19 opened 2 years ago

peni19 commented 2 years ago

SAS token for event hub requires “manage” to be accepted. Manage should not be required. Please remove this bug!

PS H:__AzureDevOps\AZUR.ManagedHSM\AZUR.ManagedHSM> az monitor diagnostic-settings create --name "*_to_event_hub" --resource $keyVaultID --logs '[{""category"": ""AuditEvent"", ""enabled"":true}]' --event-hub /subscriptions/****/resourceGroups/rt-002/providers/Microsoft.EventHub/namespaces/**/eventhubs/**** --event-hub-rule /subscriptions/***/resourceGroups/****-002/providers/Microsoft.EventHub/namespaces/**/authorizationRules/**** (BadRequest) If a valid EventHub name is not specified in the diagnostic setting, the EventHub authorization rule requires manage|send|listen access, this EventHub authorization rule does not have 'manage' access. Code: BadRequest Message: If a valid EventHub name is not specified in the diagnostic setting, the EventHub authorization rule requires manage|send|listen access, this EventHub authorization rule does not have 'manage' access.

If SAS token has “manage” permissions it works:

PS H:__AzureDevOps\AZUR.ManagedHSM\AZUR.ManagedHSM> az monitor diagnostic-settings create --name "mhsmlogs_to_event_hub" --resource $keyVaultID --logs '[{""category"": ""AuditEvent"", ""enabled"":true}]' --event-hub /subscriptions/***/resourceGroups/rg-log-mgmt-002/providers/Microsoft.EventHub/namespaces/****/eventhubs/* --event-hub-rule /subscriptions/***/resourcegroups/****/providers/Microsoft.EventHub/namespaces/evhn-logg-pr-swc-001/eventhubs/*/authorizationrules/** (BadRequest) "Resource type 'microsoft.eventhub/namespaces/eventhubs/authorizationrules' is invalid for property 'properties.eventHubAuthorizationRuleId'. Expected types are 'microsoft.servicebus/namespaces/authorizationrules', 'microsoft.eventhub/namespaces/authorizationrules'" Code: BadRequest Message: "Resource type 'microsoft.eventhub/namespaces/eventhubs/authorizationrules' is invalid for property 'properties.eventHubAuthorizationRuleId'. Expected types are 'microsoft.servicebus/namespaces/authorizationrules', 'microsoft.eventhub/namespaces/authorizationrules'"

This is the output from “az monitor diagnostic-settings list --resource $keyVaultID”

{ "eventHubAuthorizationRuleId": "/subscriptions/****/resourceGroups/*****-002/providers/Microsoft.EventHub/namespaces/**/authorizationRules/**", "eventHubName": "**", "id": "/subscriptions/****/resourcegroups/-001/providers/microsoft.keyvault/managedhsms/****/providers/microsoft.insights/diagnosticSettings/mhsmlogs_to_event_hub", "identity": null, "kind": null, "location": null, "logAnalyticsDestinationType": null, "logs": [ { "category": "AuditEvent", "categoryGroup": null, "enabled": true, "retentionPolicy": null } ], "marketplacePartnerId": null, "metrics": [], "name": "mhsmlogs_to_event_hub", "resourceGroup": "****r-001", "serviceBusRuleId": null, "storageAccountId": null, "systemData": null, "tags": null, "type": "Microsoft.Insights/diagnosticSettings", "workspaceId": null },


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

yonzhan commented 2 years ago

@kairu-ms for awareness

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @SameergMS, @dadunl.

Issue Details
SAS token for event hub requires “manage” to be accepted. Manage should not be required. Please remove this bug! PS H:\__AzureDevOps\AZUR.ManagedHSM\AZUR.ManagedHSM> az monitor diagnostic-settings create --name "*******_to_event_hub" --resource $keyVaultID --logs '[{""category"": ""AuditEvent"", ""enabled"":true}]' --event-hub /subscriptions/************************/resourceGroups/r****t-002/providers/Microsoft.EventHub/namespaces/**************/eventhubs/************ --event-hub-rule /subscriptions/*********************/resourceGroups/********-002/providers/Microsoft.EventHub/namespaces/**************/authorizationRules/**************** (BadRequest) If a valid EventHub name is not specified in the diagnostic setting, the EventHub authorization rule requires manage|send|listen access, this EventHub authorization rule does not have 'manage' access. Code: BadRequest Message: If a valid EventHub name is not specified in the diagnostic setting, the EventHub authorization rule requires manage|send|listen access, this EventHub authorization rule does not have 'manage' access. If SAS token has “manage” permissions it works: PS H:\__AzureDevOps\AZUR.ManagedHSM\AZUR.ManagedHSM> az monitor diagnostic-settings create --name "mhsmlogs_to_event_hub" --resource $keyVaultID --logs '[{""category"": ""AuditEvent"", ""enabled"":true}]' --event-hub /subscriptions/***********************/resourceGroups/rg-log-mgmt-002/providers/Microsoft.EventHub/namespaces/************/eventhubs/************* --event-hub-rule /subscriptions/*********************/resourcegroups/********/providers/Microsoft.EventHub/namespaces/evhn-logg-pr-swc-001/eventhubs/***************/authorizationrules/************** (BadRequest) "Resource type 'microsoft.eventhub/namespaces/eventhubs/authorizationrules' is invalid for property 'properties.eventHubAuthorizationRuleId'. Expected types are 'microsoft.servicebus/namespaces/authorizationrules', 'microsoft.eventhub/namespaces/authorizationrules'" Code: BadRequest Message: "Resource type 'microsoft.eventhub/namespaces/eventhubs/authorizationrules' is invalid for property 'properties.eventHubAuthorizationRuleId'. Expected types are 'microsoft.servicebus/namespaces/authorizationrules', 'microsoft.eventhub/namespaces/authorizationrules'" This is the output from “az monitor diagnostic-settings list --resource $keyVaultID” { "eventHubAuthorizationRuleId": "/subscriptions/****************/resourceGroups/*********-002/providers/Microsoft.EventHub/namespaces/**************/authorizationRules/**************", "eventHubName": "**************", "id": "/subscriptions/********************/resourcegroups/****-001/providers/microsoft.keyvault/managedhsms/************/providers/microsoft.insights/diagnosticSettings/mhsmlogs_to_event_hub", "identity": null, "kind": null, "location": null, "logAnalyticsDestinationType": null, "logs": [ { "category": "AuditEvent", "categoryGroup": null, "enabled": true, "retentionPolicy": null } ], "marketplacePartnerId": null, "metrics": [], "name": "mhsmlogs_to_event_hub", "resourceGroup": "****r-001", "serviceBusRuleId": null, "storageAccountId": null, "systemData": null, "tags": null, "type": "Microsoft.Insights/diagnosticSettings", "workspaceId": null }, --- #### Document Details ⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.* * ID: b9ae3afa-74ff-12e8-a32c-c01240bd37da * Version Independent ID: 522b7e55-2510-8e51-021a-2fc134fabfbe * Content: [az monitor diagnostic-settings](https://learn.microsoft.com/en-us/cli/azure/monitor/diagnostic-settings?view=azure-cli-latest) * Content Source: [latest/docs-ref-autogen/monitor/diagnostic-settings.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/latest/docs-ref-autogen/monitor/diagnostic-settings.yml) * Service: **monitoring-and-diagnostics** * GitHub Login: @rloutlaw * Microsoft Alias: **routlaw**
Author: peni19
Assignees: AllyW, kairu-ms
Labels: `Service Attention`, `Monitor`, `question`, `customer-reported`, `Auto-Assign`, `Azure CLI Team`
Milestone: Backlog
ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @SameergMS, @dadunl.

Issue Details
SAS token for event hub requires “manage” to be accepted. Manage should not be required. Please remove this bug! PS H:\__AzureDevOps\AZUR.ManagedHSM\AZUR.ManagedHSM> az monitor diagnostic-settings create --name "*******_to_event_hub" --resource $keyVaultID --logs '[{""category"": ""AuditEvent"", ""enabled"":true}]' --event-hub /subscriptions/************************/resourceGroups/r****t-002/providers/Microsoft.EventHub/namespaces/**************/eventhubs/************ --event-hub-rule /subscriptions/*********************/resourceGroups/********-002/providers/Microsoft.EventHub/namespaces/**************/authorizationRules/**************** (BadRequest) If a valid EventHub name is not specified in the diagnostic setting, the EventHub authorization rule requires manage|send|listen access, this EventHub authorization rule does not have 'manage' access. Code: BadRequest Message: If a valid EventHub name is not specified in the diagnostic setting, the EventHub authorization rule requires manage|send|listen access, this EventHub authorization rule does not have 'manage' access. If SAS token has “manage” permissions it works: PS H:\__AzureDevOps\AZUR.ManagedHSM\AZUR.ManagedHSM> az monitor diagnostic-settings create --name "mhsmlogs_to_event_hub" --resource $keyVaultID --logs '[{""category"": ""AuditEvent"", ""enabled"":true}]' --event-hub /subscriptions/***********************/resourceGroups/rg-log-mgmt-002/providers/Microsoft.EventHub/namespaces/************/eventhubs/************* --event-hub-rule /subscriptions/*********************/resourcegroups/********/providers/Microsoft.EventHub/namespaces/evhn-logg-pr-swc-001/eventhubs/***************/authorizationrules/************** (BadRequest) "Resource type 'microsoft.eventhub/namespaces/eventhubs/authorizationrules' is invalid for property 'properties.eventHubAuthorizationRuleId'. Expected types are 'microsoft.servicebus/namespaces/authorizationrules', 'microsoft.eventhub/namespaces/authorizationrules'" Code: BadRequest Message: "Resource type 'microsoft.eventhub/namespaces/eventhubs/authorizationrules' is invalid for property 'properties.eventHubAuthorizationRuleId'. Expected types are 'microsoft.servicebus/namespaces/authorizationrules', 'microsoft.eventhub/namespaces/authorizationrules'" This is the output from “az monitor diagnostic-settings list --resource $keyVaultID” { "eventHubAuthorizationRuleId": "/subscriptions/****************/resourceGroups/*********-002/providers/Microsoft.EventHub/namespaces/**************/authorizationRules/**************", "eventHubName": "**************", "id": "/subscriptions/********************/resourcegroups/****-001/providers/microsoft.keyvault/managedhsms/************/providers/microsoft.insights/diagnosticSettings/mhsmlogs_to_event_hub", "identity": null, "kind": null, "location": null, "logAnalyticsDestinationType": null, "logs": [ { "category": "AuditEvent", "categoryGroup": null, "enabled": true, "retentionPolicy": null } ], "marketplacePartnerId": null, "metrics": [], "name": "mhsmlogs_to_event_hub", "resourceGroup": "****r-001", "serviceBusRuleId": null, "storageAccountId": null, "systemData": null, "tags": null, "type": "Microsoft.Insights/diagnosticSettings", "workspaceId": null }, --- #### Document Details ⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.* * ID: b9ae3afa-74ff-12e8-a32c-c01240bd37da * Version Independent ID: 522b7e55-2510-8e51-021a-2fc134fabfbe * Content: [az monitor diagnostic-settings](https://learn.microsoft.com/en-us/cli/azure/monitor/diagnostic-settings?view=azure-cli-latest) * Content Source: [latest/docs-ref-autogen/monitor/diagnostic-settings.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/latest/docs-ref-autogen/monitor/diagnostic-settings.yml) * Service: **monitoring-and-diagnostics** * GitHub Login: @rloutlaw * Microsoft Alias: **routlaw**
Author: peni19
Assignees: AllyW, kairu-ms
Labels: `Service Attention`, `Monitor`, `customer-reported`, `feature-request`, `Auto-Assign`, `Azure CLI Team`
Milestone: Backlog