Authenticated Users Role and Anonymous Users role option in a Web Role in Dynamics 365 Portals/ PowerApps Portals. All you need to know about it

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com


If you have worked on PowerApps portal project, you are probably aware of Web Roles. Web Roles are security roles in PowerApps portals through which you can control the access of a portal user. And whenever you try to create a Web Role, you come across the options highlighted.
image
And trust me, even among consultants experienced portals, the concept related to these options are not clear. And every training I conduct on Portals, questions on these topics are granted.
So let’s start with the first concept– Authenticated Users Role


Let me explain in very clear terms. For a Web Role, if you set Authenticated Users Role as Yes, an user when logged in to the portal will automatically have the role. In other words when a web role has the Authenticated Users Role set to Yes, any logged in user in the portal will have that role even though the Web Role is not explicitly assigned to the portal user.
Let’s see an example here


Below is an example of a Portal contact with Web Role explicitly assigned to the contact
image
I have couple of Web Roles in my environment both of which have the option – Authenticated Users Role set to Yes
image
So let’s see how it works out. To really test this, I have modified the Home Web Template to print the user roles.

<ul>
{% if user %}
{% for role in user.roles %}
<li>{{ role }}</li>
{% endfor %}
{% endif %}
</ul>

Save your changes. And then refresh your portal cache. Let’s observe when the portal contact now login to the portal.
image
Certainly not the prettiest way to test this. But certainly proves the concept.
Isn’t it great! So you have a requirement to assign a Web Role when a user sign in to the portal, all you need is to set the Authenticated Users Role set to Yes.


So let’s start with the second concept– Anonymous Users Role

Now that we understand the concept of Authenticated Users role, it’s pretty easy to understand this option. If you set a Web role with Anonymous Users Role set to Yes, anyone browsing the portal anonymously will have that Web role automatically assigned to them.

You should be extremely careful while creating a Web Role with Anonymous Users Role set to Yes. Just make sure that the web role should not have any permission which give the anonymous user access to unwanted records.

Hope this helps!
Debajit Dutta
(Business Solutions MVP)


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading