backstage icon indicating copy to clipboard operation
backstage copied to clipboard

🐛 Bug Report: Usage of contains operator for Microsoft Graph query

Open twanbeeren opened this issue 5 months ago • 11 comments

📜 Description

I'm trying to read Users and Groups from Microsoft Entra using the Azure org data integration that is provided by Backstage.

It states that the search and filter can be adjusted to your own liking: https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http https://learn.microsoft.com/en-us/graph/search-query-parameter?tabs=http

However in the documentation only Equals (eq) is used, and I need a contains query. To be specific:

I need to read all groups in Entra that contain "string x"

👍 Expected behavior

My code:

catalog:
  providers:
    microsoftGraphOrg:
      development:
        target: https://graph.microsoft.com/v1.0
        authority: https://login.microsoftonline.com
        clientId: ${AZURE_CLIENT_ID}
        clientSecret: ${AZURE_CLIENT_SECRET}
        tenantId: ${AZURE_TENANT_ID}
        queryMode: advanced
        user:
          loadPhotos: false
        group:
          filter: displayName contains "string x"
        schedule:
          frequency: PT10M
          timeout: PT5M

I also tried the following since it used a lot.

        group:
          filter: contains(displayName,'{string x}')

It should read all groups from entra that contain "string x" (string x is obviously a different value for me)

👎 Actual Behavior with Screenshots

My logging shows me for method 1

error MicrosoftGraphOrgEntityProvider:development refresh failed, Error: Error while reading groups from Microsoft Graph: BadRequest - Invalid filter clause: Syntax error at position 20 in 'displayName contains "string x"'

Where position 20 seems to be the contains operator

My logging shows me for method 2

error MicrosoftGraphOrgEntityProvider:development refresh failed, Error: Error while reading groups from Microsoft Graph: Request_UnsupportedQuery - Operator: 'Contains' is not supported.

👟 Reproduction steps

Setup microsoft graph according to the Azure org data integration name

📃 Provide the context for the Bug.

No response

🖥️ Your Environment

I run in v1.25

I can't run yarn backstage-cli info for this unfortunately

👀 Have you spent some time to check if this bug has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

None

twanbeeren avatar Sep 04 '24 07:09 twanbeeren