Cannot Login after database refresh dynamics 365 FO on Premise
It is quite easy to do an SQL DB backup and restore. This happens often on a D365FO on-premises deployment from Production to UAT.
It gets a bit funnier when after the restore I get the message :
D365FO : You are not authorized to login with your current credentials. You will be redirected to the login page in a few seconds.
Me: Do you realize I am an administrator ? In fact, I deployed this environment so I need access now !!!
Well, few things to do.
- Run the Reset-DatabaseUsers.ps1 script in the infrastructure folder
.\Reset-DatabaseUsers.ps1 -DatabaseServer ‘<FQDN of the SQL server>’ -DatabaseName ‘<AX database name>’.
- Update the networkdomain to the adfs federation service name https://fsn.contoso.com/adfs.
A.
Go to the AXSFType directory :
cd C:\ProgramData\SF\PR-AOS-2\Fabric\work\Applications\AXSFType_App7\AXSF.Code.1.0.20240111\Packages\bin.\Microsoft.Dynamics.AX.Deployment.Setup.exe -bindir
B.
“C:\ProgramData\SF\pr-aos-2\Fabric\work\Applications\AXSFType_App7\AXSF.Code.1.0.20240111\Packages” -metadatadir “C:\ProgramData\SF\pr-aos-2\Fabric\work\Applications\AXSFType_App7\AXSF.Code.1.0.20240111\Packages” -sqluser “axdbadmin” -sqlserver “XXX” -sqldatabase “axdb” -setupmode “sync” -syncmode “fullall” -isazuresql “false” -sqlpwd “yourdbPass”
Replace the portions in bold based on your environment.
Once DB Sync is completed successfully , Happy on-premising :D.