sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Could not upload SPFx package to some MS365 tenants

Open xinzhaozhang1985 opened this issue 4 months ago • 36 comments

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

None

What browser(s) / client(s) have you tested

  • [ ] 💥 Internet Explorer
  • [ ] 💥 Microsoft Edge
  • [ ] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [x] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

  • browser version
  • SPFx version
  • Node.js version
  • etc

Describe the bug / error

We have Azure pipeline to upload SPFx package to all of our MS365 tenants. We are using m365 cli and an app registration with application permission SharePoint Sites.FullControl.All to do it. The command is as below:

m365 spo app add --filePath "C:\Dev\xxxx.sppkg" --appCatalogUrl "https://xxxxxx.sharepoint.com/sites/appcatalog" --overwrite --debug

Since yesterday 16th July 2026 , some of our MS365 tenants start throwing error "error": "{"odata.error":{"code":"-2130575223, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"Must have Manage Web Site permissions in order to add apps to site collection app catalog"}}}"

Not sure if this is intended to stop application permission for uploading SPFx package to MS365 tenant even with the SharePoint Sites.FullControl.All permission.

Steps to reproduce

  1. This only impact some of the MS365 tenants, maybe it is because per-tenant enforcement rollout
  2. Create a app registration with assign SharePoint application permission Sites.FullControl.All, generate a certificate and upload to the app reg.
  3. Consent the permission in a MS365 tenant
  4. Build a SPFx package and save
  5. m365 login --authType certificate --appId xxxxxxx --tenant xxxxx --certificateFile "C:\Dev\xxx.pfx" --password xxx --debug
  6. m365 spo app add --filePath "C:\Dev\xxxx.sppkg" --appCatalogUrl "https://xxxxxx.sharepoint.com/sites/appcatalog" --overwrite --debug

Expected behavior

The SPFx failed to upload with error "error": "{"odata.error":{"code":"-2130575223, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"Must have Manage Web Site permissions in order to add apps to site collection app catalog"}}}"

xinzhaozhang1985 avatar Jul 17 '26 12:07 xinzhaozhang1985

Hi @xinzhaozhang1985 Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.

Ashlesha-MSFT avatar Jul 20 '26 05:07 Ashlesha-MSFT

Hello,

I can certify it's happening to our tenant too, it's a developer tenant, in case it's important.

A registration app with Sites FullControl in Graph and Sharepoint, it's not capable of doing add-pnpApp (pnp library), no matter the parameters, deploying to the global app catalog.

{"odata.error":{"code":"-2130575223, | Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"Must have Manage Web Site permissions | in order to add apps to site collection app catalog"}}}

magonzalezm avatar Jul 20 '26 07:07 magonzalezm

For us, it not only impacts the developers' tenant, but also the paid tenants with SharePoint license.

xinzhaozhang1985 avatar Jul 20 '26 07:07 xinzhaozhang1985

Hi @xinzhaozhang1985,

I was able to successfully reproduce this issue on my tenant. Here are the details:

Key Finding: The API call is being rejected, even though: Certificate authentication succeeds Access token is valid App has Sites.FullControl.All permission Permission was admin-consented

This appears to be a breaking change that now requires explicit Site Collection Admin role on the app catalog, in addition to the application permission.

We are raising this as a bug to our engineering team for investigation.

Ashlesha-MSFT avatar Jul 20 '26 10:07 Ashlesha-MSFT

Hi,

So did you find a workaround?

"This appears to be a breaking change that now requires explicit Site Collection Admin role on the app catalog, in addition to the application permission."

How do we do that with an app registration?

As a user no problem.

magonzalezm avatar Jul 20 '26 10:07 magonzalezm

Don't think we can use application permission to deploy package until this is fixed. We will have to use delegate permission to deploy the package

xinzhaozhang1985 avatar Jul 20 '26 11:07 xinzhaozhang1985

Thx. The problem is that it's mandatory the human interaction to be delegated as far as I know

magonzalezm avatar Jul 20 '26 11:07 magonzalezm

If you enable the "Allow public client flow" for your app registration, you can request token use username and password. But I suggest you to use this for your internal system not the production environment.

xinzhaozhang1985 avatar Jul 20 '26 11:07 xinzhaozhang1985

Yes, furthermore, you have to use accounts without MFA.

magonzalezm avatar Jul 20 '26 11:07 magonzalezm

I confirm this is also occurring with the PnP PowerShell module since last week, as @xinzhaozhang1985 said. Please, this must be addressed as soon as possible since it is breaking all automations in an unexpected way, and there is no secure alternative for deployment as already commented on in this thread, since user accounts without MFA cannot be an option for production environments

ichesa avatar Jul 20 '26 14:07 ichesa

I converted the code from pnp to "pure" OData graph API calls, with appid and client assertion token.

And I received exactly the same result, so the origin is the Graph endpoint not pnp library, which is logical.

Example of the same error: $uploadResult = Invoke-RestMethod -Method Post -Uri 'https://xxxxx.sharepoint.com/sites/appcatalog/_api/web/tenantappcatalog/Add(overwrite=true,url='xxxxx.sppkg'')' -Headers @{ Accept = 'application/json;odata=nometadata' 'binaryStringRequestBody' = 'true', 'Authorization': 'Bearer xxxxxxxxx', 'X-RequestDigest':'xxxxxx' } -ContentType 'application/octet-stream' -InFile 'xxxx\xxxx.sppkg' `

magonzalezm avatar Jul 20 '26 16:07 magonzalezm

Can confirm the same issue over here on multiple (customer) tenants

advdberg avatar Jul 20 '26 16:07 advdberg

We have the same issue, unable to update our customers with app-only permissions. Getting this error all of a sudden.

This is our token used to authenticate the a request to https://tenant.sharepoint.com/sites/appcatalog/_api/web/tenantappcatalog/Add(overwrite=true,url='package.sppkg')

Stripped identifying parts

{
  "typ": "JWT",
  "nonce": "6u41rvWxslxi6V7fQ8HJK--IHtvOipZl4sbUVLDBfXw",
  "alg": "RS256",
  "x5t": "aFkmKVFc-4WV6sXCBvNZkXI505Y",
  "kid": "aFkmKVFc-4WV6sXCBvNZkXI505Y"
}.{
  "aud": "00000003-0000-0ff1-ce00-000000000000",
  "iss": "https://sts.windows.net/<redacted>/",
  "iat": 1784574983,
  "nbf": 1784574983,
  "exp": 1784578883,
  "app_displayname": "<redacted>",
  "appid": "<redacted>",
  "appidacr": "2",
  "idp": "https://sts.windows.net/<redacted>/",
  "idtyp": "app",
  "oid": "<redacted>",
  "roles": [
    "TermStore.ReadWrite.All",
    "User.Read.All",
    "Sites.FullControl.All"
  ],
  "sid": "<redacted>",
  "sub": "<redacted>",
  "tid": "<redacted>",
  "ver": "1.0",
  "wids": [
    "0997a1d0-0d1d-4acb-b408-d5ca73121e90"
  ]
}.[Signature]
{
    "odata.error": {
        "code": "-2130575223, Microsoft.SharePoint.SPException",
        "message": {
            "lang": "en-US",
            "value": "Must have Manage Web Site permissions in order to add apps to site collection app catalog"
        }
    }
}

ronaldvanhelden avatar Jul 20 '26 19:07 ronaldvanhelden

Same error on our clients for more than 20 tenants, this is very important

phaetto avatar Jul 21 '26 06:07 phaetto

Same here. Can there be an entry created in the Service Health dashboard in M365 Admin that we can refer customers to?

jimmywim avatar Jul 21 '26 07:07 jimmywim

same issue for us on multiple tenants. We are unable to push app updates to our customers!

nicolaor avatar Jul 21 '26 07:07 nicolaor

Hi All, We too facing same issue since Monday, 20th July. Pipelines were working fine till Friday, 17th July. All the pipelines started giving error as "Error: Must have Manage Web Site permissions in order to add apps to site collection app catalog." We have the Entra ID App with Site.FullControl.All and Site.Manage.All For MS Graph and SharePoint Application permissions.

I even tried directly adding the App to the SCA for the tenant app catalog site, but no luck. Error remains the same.

In our pipeline for SPFx solutions I tried both approach for M365 CLI as well as PnP PowerShell. It hits the same error at the end.

Option 1:

  • script: | m365 login --authType certificate --appId "AppId" --tenant "TenantId" --certificateBase64Encoded "Certificate form KeyVault" m365 spo set --url "appcatalogURL" m365 spo app add --filePath '$(System.ArtifactsDirectory)/drop/$(packageNameQA)' --overwrite --debug m365 spo app deploy --id $(solutionIdQa) --skipFeatureDeployment
    displayName: 'Add and Deploy App to app catalog'

Option 2: - task: PowerShell@2 displayName: 'Add and Deploy App via PnP PowerShell (Certificate Auth)' inputs: targetType: 'inline' script: |

            # Install PnP.PowerShell if not already installed                
            Install-Module PnP.PowerShell -Scope CurrentUser -Force
              
            # Connect using App-Only Certificate Authentication
            Connect-PnPOnline -Url "Appcatalog URL" -ClientId "AppID" -Tenant "TenantID" -CertificateBase64Encoded '$(Certificate)'

            Write-Host "Connected successfully. Uploading package..."

            # Upload package to Tenant App Catalog
            #$app = Add-PnPApp -Path '$(System.ArtifactsDirectory)/drop/$(packageNameQA)' -Scope Tenant -Overwrite                

            Write-Host "Uploaded App ID: $($app.Id). Publishing globally..."

            # Deploy globally across the tenant (--skipFeatureDeployment equivalent)
            Publish-PnPApp -Identity $app.Id -Scope Tenant

            Write-Host "App package uploaded and deployed successfully."

Interesting thing is when I connect to the appcatalog Site using below code

m365 login --authType certificate --appId "AppId" --tenant "TenantId" --certificateBase64Encoded "Certificate form KeyVault"

  • Connection is successful m365 spo app list
  • This command lists all the packages from the tenant app catalog site. But it seems it can not upload a .sppkg files to the app catalog. Returns error as below m365 spo app add --filePath '$(System.ArtifactsDirectory)/drop/$(packageNameQA)' --overwrite --debug
  • Gives error as soon as it starts to upload a package to the app catalog site.

Error at SpoAppAddCommand.handleRejectedODataPromise (file:///opt/hostedtoolcache/node/22.22.0/x64/lib/node_modules/@pnp/cli-microsoft365/dist/Command.js:245:27) at SpoAppAddCommand.commandAction (file:///opt/hostedtoolcache/node/22.22.0/x64/lib/node_modules/@pnp/cli-microsoft365/dist/m365/spo/commands/app/app-add.js:59:18) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async SpoAppAddCommand.action (file:///opt/hostedtoolcache/node/22.22.0/x64/lib/node_modules/@pnp/cli-microsoft365/dist/Command.js:208:13) at async SpoAppAddCommand.action (file:///opt/hostedtoolcache/node/22.22.0/x64/lib/node_modules/@pnp/cli-microsoft365/dist/m365/base/SpoCommand.js:102:9) at async Object.executeCommand (file:///opt/hostedtoolcache/node/22.22.0/x64/lib/node_modules/@pnp/cli-microsoft365/dist/cli/cli.js:268:9) at async Object.execute (file:///opt/hostedtoolcache/node/22.22.0/x64/lib/node_modules/@pnp/cli-microsoft365/dist/cli/cli.js:217:9) at async file:///opt/hostedtoolcache/node/22.22.0/x64/lib/node_modules/@pnp/cli-microsoft365/dist/index.js:17:9 at async file:///opt/hostedtoolcache/node/22.22.0/x64/lib/node_modules/@pnp/cli-microsoft365/dist/index.js:4:1

Timings: api: 714.250847ms core: 28.043446ms command: 811.431329ms options: 0.165551ms total: 840.478098ms validation: 0.466616ms Error: Must have Manage Web Site permissions in order to add apps to site collection app catalog Error: Must have Manage Web Site permissions in order to add apps to site collection app catalog

The Possible workaround I could think of is use the Service Account (without MFA) for the time being and store the password in the key vault / Library or something. Add the Service Account to the SCA of the app catalog site. Please do share if anyone has found any other approach to overcome this issue with pipeline based deployments.

rahoolc avatar Jul 21 '26 13:07 rahoolc

We are experiencing the same issue and can provide some additional data points:

  • Our first affected tenant started failing around 14 July, with other tenants being impacted progressively afterwards, which appears consistent with a staggered per-tenant rollout.
  • We can reproduce the issue using direct SharePoint ALM REST calls (/_api/web/tenantappcatalog/Add), CSOM, and PnP PowerShell. The same error occurs across all three approaches, suggesting the enforcement is being applied to the app-only identity rather than any specific API surface.

We have tried several mitigation approaches without success.

This issue is currently blocking our automated CI/CD deployment processes and preventing application updates across multiple client tenants. Any information regarding an ETA for a fix or a supported workaround would be greatly appreciated.

benjacernuda avatar Jul 21 '26 13:07 benjacernuda

Confirming this — with diagnostics that narrow the scope.

Same symptom on one of our tenants: SPFx .sppkg upload to the tenant app catalog fails for app-only auth with:

Must have Manage Web Site permissions in order to add apps to site collection app catalog

Environment / repro

  • Entra app, application permissions, certificate auth (client-secret app-only is separately rejected by SP REST with Unsupported app only token, so cert is required regardless)
  • SharePoint API Sites.FullControl.All (confirmed present in the SharePoint-audience token's roles)
  • Reproduces identically on both m365 spo app add --appCatalogScope tenant --overwrite and PnP Add-PnPApp -Path … -Scope Tenant -Overwrite (connected straight to the app catalog URL, so it isn't a tenant-catalog resolution quirk)
  • Last successful deploy 2026-06-23; first failure 2026-07-16 — consistent with a gradual rollout

Things that did NOT resolve it (so others can skip them):

  • Tenant-wide SharePoint Sites.FullControl.All (baseline — already held)
  • An explicit site-level fullControl grant on the app catalog site (Graph POST /sites/{id}/permissions, Sites.Selected)
  • Graph AppCatalog.ReadWrite.All — that permission governs the Teams app catalog (/appCatalogs/teamsApps); there is no Graph endpoint for the SharePoint SPFx app catalog, so it has no effect here

Evidence it's app-only authorization specifically — not a hold / DLP / lock:

  • GET on the app catalog drive returns 200
  • A plain file write to a different library on the same site (e.g. "Client Side Assets") returns 201
  • The existing .sppkg has no retention label
  • Every event receiver on the "Apps for SharePoint" library is Microsoft built-in (SharePoint App Adding, ItemAdding, synchronous, Microsoft.SharePoint assembly) — no custom/third-party receiver
  • The raw Graph drive file-PUT that some pipelines used as a shortcut is separately cancelled now by that same built-in receiver: 403 accessDenied: "Request was cancelled by event received. If attempting to delete a non-empty folder, it's possible that it's on hold"

Traceable request ID: the Add failures via m365/PnP don't surface a SharePoint CorrelationId in non-verbose mode, but here's a Graph request-id from the same tenant for the related built-in-receiver cancellation on the app-catalog library (the 403 accessDenied above): 6ccbe5a0-46ab-475e-a815-cea08e16dbf6. Happy to re-run Add with --debug / -Verbose to capture the SPRequestGuid for the exact "Manage Web Site" failure if that helps triage.

Workaround for now: build the .sppkg in CI as usual and upload it via the app catalog UI (Apps for SharePoint → Upload → Deploy), which is unaffected. We've parked our GitHub Actions deploy on manual and gated the automated PnP step behind a flag to flip back once this is fixed.

thatsatechnique avatar Jul 21 '26 15:07 thatsatechnique

Hello everyone, thank you for your patience as we work through this issue.

At this time we've identified the root cause of the issue. Indeed, this is specifically affecting app-only authorization for uploading SPPKG's to the App Catalog. We're working on resolution steps including identifying workarounds. I'll give an update here shortly.

nick-pape avatar Jul 21 '26 16:07 nick-pape