microsoft / microsoft/CopilotStudioSamples

Unable to Deploy SPFx Agent to a Single SharePoint Site (Works Only with Tenant-Wide Deployment)

Open
#531 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
797
Forks
491
PR merge metrics
No merged PRs in 30d

Description

I have developed an SPFx Application Customizer that hosts a Copilot/Agent sidebar in SharePoint.

Scenario 1: Tenant-Wide Deployment (Works)

When I upload the .sppkg package and select "Enable this app and add it to all sites":

The extension is automatically added to Tenant-Wide Extensions.
I configure the following properties:
Client App ID
Tenant ID
Redirect URL
The bot icon appears in SharePoint.
The agent connects successfully and works as expected.

However, because the deployment is tenant-wide, the bot icon also appears on all other SharePoint sites, which is not my requirement.

Scenario 2: Single Site Deployment (Fails)

When I upload the same .sppkg package and select "Only enable this app":

No entry is created in Tenant-Wide Extensions.
The app is available on the target SharePoint site.
The agent attempts to connect but fails with the error:
Plain Text
Unable to Acquire Token

Show more lines
Troubleshooting Attempted

  1. Set skipFeatureDeployment to false
    JSON
    {

"skipFeatureDeployment": false

}

Result: No change.

  1. Register the Application Customizer manually using PnP PowerShell
    PowerShell
    Add-PnPCustomAction `

-ClientSideComponentId 4c6e29f2-7eee-4f9f-bbd2-20c8859d0ba2 `

-ClientSideComponentProperties '{"appClientId":"...","tenantId":"...","directConnectUrl":"..."}' `

-Location ClientSideExtension.ApplicationCustomizer `

-Name "SidebarAgent" `

-Title "SidebarAgent" `

-Scope Web

Show more lines

Result: The agent still fails with "Unable to Acquire Token".

even MS support team suggest to delete or remove the ClientSideInstance.xml file and build the solution package. i Did same but result is same

Questions
Why does token acquisition work when the extension is deployed tenant-wide but fail when deployed to a single site?
Is there any additional configuration required for site-scoped deployment?
What is the recommended approach to deploy an SPFx Application Customizer/Agent to only one SharePoint site?
Has anyone successfully implemented a single-site deployment for a similar SPFx-based agent?
Expected Behavior

The agent should be available and functional only on the target SharePoint site, without appearing on other sites across the tenant.

Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the tenant-wide and single-site .sppkg deployment settings, including skipFeatureDeployment and ClientSideInstance.xml, and review the PnP PowerShell custom action configuration. Reproduce both deployment paths and trace where token acquisition differs; done means the agent authenticates on the target site without appearing on other sites.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript
Domain
authentication, devops, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.