Failed internal Azure AD authentication with Dynamics 365 portal

If you’ve ever had contact with a Dynamics 365 portal, you’ve probably noticed the “Azure AD” button. This enables authentication with the Azure AD of your Dynamics environment.

But we had an error when rolling out the portal, so I had to restart the process. After successful completion, the portal could be reached at “MYURL. microsoftcrmportals. com”, but the Azure AD registration failed.

Failed internal Azure AD authentication with Dynamics 365 portal
Failed internal Azure AD authentication with Dynamics 365 portal

I will spare you the execution of my whole Trail&Error orgy and tell you what the problem is.

Solution

During the deployment the reply addresses of the registered Azure AD APP have been missconfiguered. To find it navigate in your browser to portal.azure.com and click:

Failed internal Azure AD authentication with Dynamics 365 portal
Failed internal Azure AD authentication with Dynamics 365 portal

The reply adresses looked like (notice the “1” at the end of the subdomain)

Failed internal Azure AD authentication with Dynamics 365 portal

but the should be like

Failed internal Azure AD authentication with Dynamics 365 portal

So I edited the first entry and add the second (https://portaladmin-eur.portal-infra.dynamics.com/PortalDetails/AuthorizationResult/YOUR_ID). You find the needed ID for the second in the admin console of your portal.

Failed internal Azure AD authentication with Dynamics 365 portal

 


Disable a section on profile form on Dynamics 365 portal dynamically

At the moment I’am setting up a community portal, where it is planned that the users can register themselves.

The portal users should also be able to enter their company name.
To do this, I use the field “adx_organizationname” provided by the portal because with an account lookup everyone could see our customers. The backoffice then checks whether this contact is related to an existing company or a new one. As soon as the contact is then connected to an account record, the organization name should no longer be changeable by the portal user.

What not worked

  • Javscript on CRM form.
  • Business Rule on CRM form (because it is Javascript).
  • Add the field twice to the form to have one editable and one readonly and hide the the not applicable with jQuery in the portal.
    The same fiels two times on the profile form let the portal crash.
  • Make the field readonly on the CRM form and enable it in the portal with jQuery did not save the data back to CRM.

Solution

I have created a separate section for the company-related fields

Disable a section on profile form on Dynamics 365 portal

and make it readonly when parentcustomer is not empty.

Disable a section on profile form on Dynamics 365 portal

This creates following tag in the HTML structur.

Disable a section on profile form on Dynamics 365 portal

The result looks like this.

Disable a section on profile form on Dynamics 365 portal

Oh wait, happy times, Dynamics portals has arrived my blog for the firtst time!