Skip to content

Resource Health Events List by Tenant Id 403 Forbidden #4471

@weixian-zhang

Description

@weixian-zhang

Link to sample

https://learn.microsoft.com/en-us/rest/api/resourcehealth/events/list-by-tenant-id?view=rest-resourcehealth-2022-10-01&tabs=JavaScript#listeventsbytenantid

Library name and version

@azure/arm-resourcehealth, @azure/identity

Language of the Sample

  • C#/.NET
  • Java
  • JavaScript/TypedScript
  • Python
  • Golang
  • Other - Please specify in Issue details field

Sample Issue Type

  • Sample not working
  • Sample missing
  • Do not understand sample

Issue details

Node app when accessing service health events List by Tenant Id, get 403 forbidden error
https://management.azure.com/providers/Microsoft.ResourceHealth/events

image

Has the following configured:

  • access using AzureDefaultCredential with AZURE_CLIENT_ID, AZURE_TENANT_ID and AZURE_CLIENT_SECRET exist in env vars.
  • registered App is assigned with tenant role: "Global Admin" and "Security Admin"
  • registered App is assigned with custom role at management group with all "MicrosoftResourceHealth" permissions
  • registered App has granted "Azure Service Management - user_impersonation" scope
{ "error": { "code": "AuthorizationFailed", "message": "The client '06bc32ab-5ab5-4b8d-9f6c-95d0a420eb95' with object id '06bc32ab-5ab5-4b8d-9f6c-95d0a420eb95' does not have authorization to perform action 'Microsoft.ResourceHealth/events/read' over scope '/providers/Microsoft.ResourceHealth' or the scope is invalid. If access was recently granted, please refresh your credentials." } } ![image](https://github.com/Azure/azure-rest-api-specs-examples/assets/43234101/8fcce67b-7be1-4526-a68b-79a2d4b1152f)

Expected behavior

expects a successful response with HTTP code 200

Actual behavior

API responded 403 forbidden

{
"error": {
"code": "AuthorizationFailed",
"message": "The client '06bc32ab-5ab5-4b8d-9f6c-95d0a420eb95' with object id '06bc32ab-5ab5-4b8d-9f6c-95d0a420eb95' does not have authorization to perform action 'Microsoft.ResourceHealth/events/read' over scope '/providers/Microsoft.ResourceHealth' or the scope is invalid. If access was recently granted, please refresh your credentials."
}
}

Reproduction Steps

No response

Environment

Node 20.x
Windows 11

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions