Share via

Copilot Studio breaks variable knowledge sources when adding a filter

Arvid Halleby Skarrie 0 Reputation points
2026-06-24T13:12:29.8133333+00:00

I have used variable knowledge sources as according to https://learn.microsoft.com/en-us/microsoft-copilot-studio/knowledge-add-sharepoint#use-variables-as-urls . It works fine until I add a filter to the knowledge source, like titles that shouldn't be used or similar. Then the source changes from a variable to a string. Then it tries to use '{variable}' instead of resolving it.

I have seen the difference in the code. When it works:
site: =$"{Global.MyVariable}"
When it doesnt work:
site: "{Global.MyVariable}"
This change can't be reversed in the UI either, even if it is possible in code. I haven't mapped exactly what part of the process causes this, except I know that adding a filter to the knowledge source does.

This should have been tagged with Copilot Studio or Power Platform, but I couldn't find such a tag.

Microsoft Copilot | Microsoft 365 Copilot | Development

1 answer

Sort by: Most helpful
  1. AI answer

    2026-06-24T13:12:47.52+00:00

    Variable knowledge source URLs in Copilot Studio are supported, but the behavior described (the URL changing from an interpolated/Formula form to a literal string when adding a filter) isn’t documented as configurable behavior. The supported and documented pattern is:

    1. Create a string variable with Global scope.
    2. Set its value via topic inputs, user profile, environment variables, or flows/connectors.
    3. Insert that variable into the knowledge source URL using {x} (Insert variable) so that at runtime the URL is resolved and used for grounding.
    4. Optionally, use Power Fx formulas to map inputs (for example, product names) to URL paths, and then use the resulting global variable in the URL, such as:
         https://www.microsoft.com/en-us/{GlobalProductURL}
      

    This mechanism is explicitly supported for both public website and SharePoint knowledge sources and is what ensures that the variable is resolved at runtime rather than treated as a literal string.

    The documentation does not describe any supported way to alter or override how the URL is stored or interpreted once additional configuration (such as filters) is applied, nor does it describe a UI path to revert a URL that has been converted from a variable expression to a literal string. The only documented and supported approach is to:

    • Keep using a Global string variable for the URL.
    • Insert it via Insert variable in the URL field.
    • Ensure the variable resolves to a valid URL that meets the knowledge source requirements.

    Given that adding a filter causes the URL to be treated as a literal string and this cannot be reversed in the UI, this behavior is not covered as configurable in the available documentation and should be treated as a product issue/bug rather than something that can be fixed through supported configuration alone.

    The practical next step is to keep the variable-based setup as documented and open a support case or feedback ticket for Copilot Studio so the product team can address the behavior where adding filters changes the URL from a variable expression to a literal string.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.