Pnpframework: [BUG] There is an issue in pnp framework that if it is in an app-only context and we have the access token, then it uses Microsoft Graph, but it ignores PreferredDataLocation at CreateTeamSiteViaGraphAsync

Created on 8 Apr 2021  Â·  4Comments  Â·  Source: pnp/pnpframework

Reporting an Issue or Missing Feature

Bug

Expected behavior

Site created within the correct Geo Tenant

Actual behavior

Site created in home tenant

Steps to reproduce behavior

reating a site with a preferredDataLocation usign REST works

Connect-PnPOnline -Url <admin site url> -ClientId <ClientId> -Tenant <tenantid> -Thumbprint <Thumbprint>

$accessToken = Get-PnPGraphAccessToken 
$header = @{ Authorization = "Bearer $($accessToken)"}         

$uri = https://graph.microsoft.com/v1.0/groups

$body = @{"displayName"="Test"; 
          "mailEnabled"=$false; 
          "groupTypes"=@("Unified"); 
          "securityEnabled"=$false; 
          "mailNickname"="ps1";
          "preferredDataLocation"="NAM"
    } | ConvertTo-Json

$response = Invoke-RestMethod –Uri $uri –Headers $header –Method Post –ContentType "application/json" -Body $body

Using New-PnPSite with an account works but using New-PnPSite with an App ID does not create site in GEO tenant even by connecting to GEO tenant and/or using -PreferredDataLocation

It seems that PreferredDataLocation is ignored in CreateTeamSiteViaGraphAsync

Also, it seems that the PreferredDataLocation parameter disappear at some point

What is the version of the Cmdlet module you are running?

1.5

Which operating system/environment are you running PnP PowerShell on?

  • [x ] Windows
  • [ ] Linux
  • [ ] MacOS
  • [ ] Azure Cloud Shell
  • [ ] Azure Functions
  • [ ] Other : please specify
provisioning âš™ backlog

Most helpful comment

@jansenbe - working on it :)

All 4 comments

@svermaak / @gautamdsheth / @erwinvanhunen : the PDL is indeed not passed along the PnP Framework API calls. Something that can be fixed...adding this to our backlog as we're swamped with work, if you would be able to create a PR that would speed up the delivery of this.

@jansenbe - working on it :)

@svermaak : this has been fixed for PnP Framework. @gautamdsheth can let you know if there's additional work needed in PS, if not this should now work with the next set of nightly releases we create

Thank you Guys!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MattiaBonanni picture MattiaBonanni  Â·  4Comments

StevieBleeds picture StevieBleeds  Â·  10Comments

roberAlb picture roberAlb  Â·  5Comments

Swampen picture Swampen  Â·  3Comments

mohammadamer picture mohammadamer  Â·  5Comments