1

Using SharePoint Online Management Shell and Set-SPOSite I can set the Conditional Access Policy on individual OneDrive sites. Is it possible to do the same thing with PnP PowerShell? I can only find this setting on the tenant level cmdlet (Set-PnPTenant).

Since there is no way to use automation with SPO cmdlets when legacy authentication is disabled, I have to find another way to set this property.

  • Found any solutions to this? Have the exact same problem.. – Fredrik Apr 3 at 15:07
  • @Fredrik - have posted an answer to this question, can you try that out ? – Gautam Sheth Apr 4 at 16:37
0

It is not supported natively using the Set-PnPTenantSite commandlet, however you can use Get-PnPTenantSite commandlet to get the site collection object and then update it as per your requirement.

You can use it as below:

$context = Get-PnPContext
$site = Get-PnPTenantSite -Url "https://tenant.sharepoint.com/sites/test"
$site.ConditionalAccessPolicy = [Microsoft.Online.SharePoint.TenantManagement.SPOConditionalAccessPolicyType]::AllowLimitedAccess
$site.Update()
$context.Load($site)
Invoke-PnPQuery
  • This works perfectly, thanks! I used the method outlined here to connect. – josjo Apr 5 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.