question

HectorMHuertaJimenez-3513 avatar image
0 Votes"
HectorMHuertaJimenez-3513 asked LimitlessTechnology-2700 answered

diagnostic settings creating sending to event hub porwershell script is not working

When tried to execute the powershell script to generate a diagnostic setting in a resource is failing.



Set-AzDiagnosticSetting -ResourceId $Resourceid -Enabled $True -Name "Diagtest" -EventHubName $EventHubName -EventHubAuthorizationRuleId $EventHubAuthorizationRuleId

Set-AzDiagnosticSetting: Exception type: ErrorResponseException, 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'", Code: BadRequest, Status code:BadRequest, Reason phrase: Bad Request

i obtained the eventhubautorizationruleid from my evenhub using

Get-AzEventHubAuthorizationRule -ResourceGroupName "scem-p-rgp-log" -NamespaceName "scem-p-ehn" -EventHubName "activitylogs"

do you know how i need to obtain $EventHubAuthorizationRuleId parameter that work ok?

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello @HectorMHuertaJimenez-3513

To obtain correctly EventHubAuthorizationRule you can check the official Microsoft sites:

az eventhubs eventhub authorization-rule
https://docs.microsoft.com/en-us/cli/azure/eventhubs/eventhub/authorization-rule?view=azure-cli-latest

and here:

Get-AzEventHubAuthorizationRule
https://docs.microsoft.com/en-us/powershell/module/az.eventhub/get-azeventhubauthorizationrule?view=azps-6.4.0


--If the reply is helpful, please Upvote and Accept as answer--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.