Add-PnPTenantTheme - Attempted to perform an unauthorized operation.

Brass Contributor

I've tried to upload a theme, but I'm geting an Attempted to perform an unauthorized operation


I'm an admin on the particular site I'm trying to upload to, so I assumed this would be enough permissions?


Do I need other permissions in order to be able to do this task?






12 Replies

Hi @Lee-Martin ,

Add-PnPTenantTheme tries to create a new theme that you can use tenant-wide in all site collections. You need SharePoint Admin permissions and you have to be connected to the admin site to use that command.

I use a PnP site template to  invoke a custom theme on a single site collection:

<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="">
  <pnp:Templates ID="ThemeTemplate">
    <pnp:ProvisioningTemplate ID="ThemeProvisioningTemplate" >
      <pnp:Theme Name="MyColorTheme" IsInverted="false">
        "themePrimary": "#aaaaaa",
        "themeLighterAlt": "#fefcf6",
        "themeLighter": "#fcf3dd",
        "themeLight": "#fae8bf",
        "themeTertiary": "#f4d282",
        "themeSecondary": "#efbe4b",
        "themeDarkAlt": "#d5a32f",
        "themeDark": "#b48a28",
        "themeDarker": "#85661d",
        "neutralLighterAlt": "#f8f8f8",
        "neutralLighter": "#f4f4f4",
        "neutralLight": "#eaeaea",
        "neutralQuaternaryAlt": "#dadada",
        "neutralQuaternary": "#d0d0d0",
        "neutralTertiaryAlt": "#c8c8c8",
        "neutralTertiary": "#a9a9a9",
        "neutralSecondary": "#8d8d8d",
        "neutralPrimaryAlt": "#727272",
        "neutralPrimary": "#020202",
        "neutralDark": "#3a3a3a",
        "black": "#1e1e1e",
        "white": "#ffffff",
        "bodyBackground": "#ffffff",
        "bodyText": "#020202"
Invoke-PnPSiteTemplate .\theme.xml

But there might be better ways to do so.

Best Regards,

Thanks, I've tried that an am getting the error

Invoke-PnPSiteTemplate : Cannot contact site at the specified URL https://<myhomesite><mysite>. There is
no Web named "/<mysite>/_vti_bin/sites.asmx".

Hello @Lee-Martin,

Are you connected to the correct url? Like


What happens, if you execute the command "Get-PnPWeb"?
Do you get the same error?

Best Regards,

I am connected, and I get a similar error when I run that command
Mhm.... thats wierd..
Get-PNPWeb should give you the name of the site you are connected to, even if you just have "read" permissions.
How did you connect to the site? What was the output of "Connect-PnPOnline"?

Best Regards,

I'm using Connect-PnPOnline -Url https://<homesite><site> -Interactive

The response when I try and add a theme using your method above gives me

Cannot contact site at the specified URL https://<homesite><site>. There is
no Web named "/gskgepo/_vti_bin/sites.asmx".

What is this "/_vti_bin/sites.asmx" stuff that gets added to the end?

Figured it out, I needed to add sites before /<site>



However, the theme is not appearing in SharePoint (it doesn't appear in change the look)

I can't find any indication as to where there is a template either?

How can I find this? According to PnP it has uploaded properly.

Hello @Lee-Martin ,


if you apply the theme via the "Invoke-PnPSiteTemplate" command, it is applied immediately as the current selection below site theme for the current site and does not show up below the "Sharepoint Theme themes". But you don't need to be a SharePoint Admin to do so.


If you want your theme to be displayed below "SharePoint themes", you need to connect to your SharePoint admin site ("https://<tenant>") as a SharePoint administrator and invoke the Add-PnPTenantTheme command. But you need to be a SharePoint admin for that and that theme will be available on all sites.

$themepalette = @{
  "themePrimary" = "#00ffff";
  "themeLighterAlt" = "#f3fcfc";
  "themeLighter" = "#daffff";
  "themeLight" = "#affefe";
  "themeTertiary" = "#76ffff";
  "themeSecondary" = "#39ffff";
  "themeDarkAlt" = "#00c4c4";
  "themeDark" = "#009090";
  "themeDarker" = "#005252";
  "neutralLighterAlt" = "#f8f8f8";
  "neutralLighter" = "#f4f4f4";
  "neutralLight" = "#eaeaea";
  "neutralQuaternaryAlt" = "#dadada";
  "neutralQuaternary" = "#d0d0d0";
  "neutralTertiaryAlt" = "#c8c8c8";
  "neutralTertiary" = "#a6a6a6";
  "neutralSecondaryAlt" = "#767676";
  "neutralSecondary" = "#666666";
  "neutralPrimary" = "#333";
  "neutralPrimaryAlt" = "#3c3c3c";
  "neutralDark" = "#212121";
  "black" = "#000000";
  "white" = "#fff";
  "primaryBackground" = "#fff";
  "primaryText" = "#333"
Add-PnPTenantTheme -Identity "MyCompanyTheme" -Palette $themepalette -IsInverted $false

Best Regards,

So there is no way to just do it for just one site? My client doesn't want me to have admin access across the whole Site collection
Well... you can directly set the theme colors on one site using the "Invoke-SiteTemplate" approach, but it seems like you can not add new themes to the gallery just for the one site.

Otherwise..... You could ask your client to execute that Add-PnPTenantTheme command.... But remember; Then the Theme will be available on every site in the tenant.

Best Regards,