Repository navigation
Setting conditional access policy #5456
|
I need to setup conditional access policy The only parameter I can provide the policy name appears is ProtectionLevelName Tried various combinations including the below Can someone advise what's the right parameter please? |
Replies: 2 comments 2 replies
|
ProtectionLevelName takes the name of the authentication context, not the name of the Conditional Access policy. SharePoint never references the policy; it tags the site with the context, and the policy in Entra targets that context. So for your setup: Set-PnPTenantSite -Identity "https://tenant.sharepoint.com/sites/Policy-Test" -ConditionalAccessPolicy AuthenticationContext -ProtectionLevelName "SharePoint - Restricted Site" Two things to check if it still refuses the name: the authentication context must be published in Entra (Protection, Conditional Access, Authentication contexts, with "Publish to apps" on), and the Conditional Access policy "EU SharePoint" must list that context under Target resources. Once both are true, opening the site triggers the policy. |
|
Glad it worked. The blank is not your tenant; it is a gap in the cmdlet. When Set-PnPTenantSite applies the context it writes the name to the site property AuthContextStrength. Get-PnPTenantSite builds its output from that same property set, and its model declares ProtectionLevelName but never copies AuthContextStrength into it, so the field comes back empty no matter what is applied. The ConditionalAccessPolicy column reads correctly because that one is copied. Two ways to read the applied name today:
The right fix is one line in the module, mapping AuthContextStrength to ProtectionLevelName in the site model, and it is worth an issue on this repository so the property reads back the same way it is written. If this answers it, please mark the thread as accepted so the next person finds it. And if you are curious what I build, my repositories are at github.com/tltaylor1; a ⭐ on anything you find interesting is always appreciated. |

Glad it worked. The blank is not your tenant; it is a gap in the cmdlet.
When Set-PnPTenantSite applies the context it writes the name to the site property AuthContextStrength. Get-PnPTenantSite builds its output from that same property set, and its model declares ProtectionLevelName but never copies AuthContextStrength into it, so the field comes back empty no matter what is applied. The ConditionalAccessPolicy column reads correctly because that one is copied.
Two ways to read the applied name today:
The SharePoint Online management shell exposes it directly:
Get-SPOSite -Identity "https://tenant.sharepoint.com/sites/Policy-Test" | Select-Object Url, ConditionalAccessPolicy, Authentic…