Wednesday 3 May 2017

D365 - You are not authorized to login with your current credentials

If you're restoring Dynamics 365 for Operation database with a backup from another environment, one of the error you might get is "You are not authorized to login with your current credentials. You will be redirected to the login page in a few seconds.".




To fix that, you just need to rerun the "AdminUserProvisioning" tool again.
If you're still getting the error after running the provisioning tool, check the event log.

One of the possible cause would be this database from another environment hasn't been sync with your environment yet, hence, giving some error of this or that field is not found, etc.
Try synchronize the DB, then do an iisreset.




3 comments:

  1. How to fix this case in Microsoft Hosted environments?

    ReplyDelete
  2. execute the following scripts against the new data base


    Tenantid from SysServiceConfigurationSetting table

    update [dbo].[SYSSERVICECONFIGURATIONSETTING]
    set value =''
    where name = 'TENANTID'

    update dbo.POWERBICONFIG
    set TENANTID = ''

    update dbo.PROVISIONINGMESSAGETABLE
    set TENANTID = ''

    you should update following values from old Database to current Database on the respective users on userinfo table..


    and SID, ObjectID, identifier....

    e.g

    --UPDATE U
    --SET U.NETWORKALIAS = '',
    --    U.NETWORKDOMAIN = '',
    --    U.SID = '',
    --    IDENTITYPROVIDER = '',
    --    OBJECTID = '',
    --    Enable = 1
    --FROM UserInfo U
    --WHERE U.Id LIKE 'user id'

    ReplyDelete
  3. Generally speaking, on any D365 Finance and Operations environment, the user which will remain always enabled is 'Admin'. This is not a user with System Administrator privileges in D365, but this a reserved user by D365 to be assigned to the environment administrator by default (or any other user which should be the defacto Admin).
    Now, when you copy a database from source, the source copies over all the information including the 'Admin' user. You should update the 'Admin' on the restored copy to the actual 'Admin' on the environment. To do this run the following script:
    DECLARE @SID NVARCHAR(124)
    DECLARE @NetworkAlias NVARCHAR(255)
    SELECT
    @SID = [SID]
    ,@NetworkAlias = NetworkAlias
    FROM [AxDB_Orig].[dbo].[UserInfo] WHERE Id = 'Admin'
    UPDATE [AxDB].[dbo].[UserInfo] SET
    [SID] = @SID
    ,NetworkAlias = @NetworkAlias
    WHERE Id = 'Admin'
    In the above script [AxDB_Orig] denotes the original database that was a working copy before restore.

    ReplyDelete