New-PnpSite ignores language App-Only

Last week i had been struggling for hours trying to create a sharepoint online Sitecollection via PNP Powershell.

It was a Tenant with German language as Default.

Problem

I started the follwing script and indicated 1033 as LCID, which should create an english Sitecollection

New-PnPSite -Type TeamSite -Lcid 1033(English) -Alias $alias -Owners $owners

But, the site was on german.

When i call :

/_api/web?$select=language 

I find that the Site has 1031(german) as language…

I tried to create an english Site manually(via the Central administration) and all was fine, the site was created with the correct Language

Solution

I was using and App-Only authentification based on an Azure AD App.

Connect-PnPOnline -ClientId $clientId -Thumbprint $thumbprint -Tenant $tenant

How you connect should actually make no difference, but it unfortunately did….

The Sitecollection was created with the correct language if i use :

Connect-PnPOnline -useWebLogin

After searching a bit on internet, i found out that i am not the only one facing this problem, and i figured out that it is just a bug with PNP Powershell : Link

Workaround

Unfortunately you need to change your authentification methode from App-Only to Delegate:

$encpassword = convertto-securestring -String $Password -AsPlainText -Force

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $Login, $encpassword

Connect-PnPOnline -Url $url -Credentials $cred

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.