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.

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

1 Answer 1

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
1
  • This works perfectly, thanks! I used the method outlined here to connect.
    – josjo
    Apr 5, 2019 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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