Tuesday, February 17, 2026

JIT Access(Just In Time)

JIT access to TEST/UAT

Just-in-time access which is required for various troubleshooting efforts, running unplanned queries, or data upgrade problem solving.

Go to LCS and select the environment for which you wanted to connect the database. In my case, I am using TEST.

Enter the firewall by adding the IP address of the Dev VM from where the database will be connected.

Upon clicking Confirm, there will be a message which says about the expiry time of this firewall. Usually 8 hours.

The next step is accessing the database and the mode needed.

In the LCS page, under Database Accounts section, 4 options will be displayed for the accessing reason. As we are troubleshooting, we need write access and thus selecting ‘Troubleshooting tuning for AX”.

Select the reason and enter the details.

Click ‘Request Access’ and refresh the page. User will be presented with the login details .

Note down the details of SQL server, database name , user name and password.

These are needed when we connect the database from dev VM.

Refer Microsoft link for further information

Connect to Test Database

Now with the above credentials, connect to the TEST database and create a new login which will be used for debugging.

Use SQL Server authentication login(not Windows) to connect the database

Execute the below query which creates the new user used for debugging .

CREATE USER [axdevdebugadmin] WITH PASSWORD=N'Pass@word1', DEFAULT_SCHEMA=[dbo]
GO
EXEC sp_addrolemember N'db_owner', 'axdevdebugadmin'
GO

Web.Config changes:

Connect to the VM and navigate to the folder having ‘AOS Service’ -> WebRoot and select web.config file.

Take a copy of this file as we are going to modify some of the details in the file to connect the dev VM to TEST database.

Stop the following services :

IIS

World wide publishing

MS Dynamics 365 Batch

MS Dynamics 365 DIXF

Close the VS

Any active connection to local SQL db.

Right click on ‘Web.config’ file and open in Notepad. Make changes to the following tags.

<add key="DataAccess.Database" value="LCS JIT database name" />
<add key="DataAccess.DbServer" value="LCS JIT database server />
<add key="DataAccess.SqlUser" value="LCS JIT user name" />
<add key="DataAccess.SqlPwd" value="LCS JIT password" />
<add key="DataAccess.AxAdminSqlPwd" value="pass@word1" />
<add key="DataAccess.AxAdminSqlUser" value="axdevdebugadmin" />

Start the IIS and World wide publishing service.

Connect the Dev VM URL . You can check if it is accessing the test database by navigating to

System Administration -> Inquiries -> Database -> Database Information

Now the system is ready to start the debugging.

Tips and precautions while doing the process

  1. Make sure the VM and the higher environment are in the same version .
  2. Latest code in the VM where the debugging is triggered. Remove unwanted pending changes and do a buikd+sync in the VM before initiating the connection.
  3. It is always recommended to have the code base same in both the environments.
  4. Do not trigger database sync after connecting to TEST/UAT database .
  5. Take a copy of the web.config file before making the changes.
  6. Revert the changes once the debugging is finished. If left with the same web.config file , the URL will be inaccessible after 8 hours. Please note the JIT is alive only for 8 hours.
  7. If the database is refreshed within 8 hours, we need to generate a new JIT access.
  8. After connecting, please do not change the configuration








Wednesday, January 28, 2026

How to run Runnable class in Sandbox enviornment.

I created a runnable class, and it is working fine in the development environment. After that, I moved the class to the Tier-2 environment.

URL:-

https://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=USMF&mi=SysClassRunner&cls=ShowInvoicedOrderCount




Customization for Company ID in Assign Organization Form D365 in X++.

 Business Requirement Overview:

The organisation requires the Company ID to be visible along with the Company Name in the Assign Organisation form.
This enhancement will help users easily identify companies, especially when multiple companies have similar or identical names.

 

Scenario: Customise the company name with the company id

Customise the Assign Organisation form to display the Company ID along with the Company Name.

System administration>User>Assign Organisation

 

Current Behaviour:

·       The Assign Organisation form displays only the Company Name.

·       The Company ID is not visible to the user.

Required Behaviour:

·       The Company ID should be displayed along with the Company Name in the Assign Organisation form.

·       The display format should clearly identify both values.


Code:-

[ExtensionOf(FormStr(SysSecRoleAssignOM))]
internal final class SysSecRoleAssignOM_Extension
{
    public void fillTree()
    {
        next fillTree();
        CompanyInfo ci;
        OMHierarchyRelationship relationship;
        OMInternalOrganization  organization;
        boolean hasChildren;

        organizationTree.deleteAll();

        if (!hierarchyId)
        {
            while select Name, Dataarea,RecId from ci
            {
                SysFormTreeControl::addTreeItem(
                    organizationTree,
                    ci.Name + "- ("+ci.dataarea +")",
                    FormTreeAdd::Root,
                    ci.RecId,
                    this.getImage(ci.RecId),
                    false);
            }
        }
    }

}







Unable to find report design in D365 F&O X++

I am encountering an issue while opening a standard report. The error displayed is ‘Unable to find report design.

ERROR:-

At that time, the report was deployed using Windows PowerShell. After running the deployment command, the report opened successfully.

1. Open Windows PowerShell as a system administrator.




2. For deploying a specific SSRS report.

K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -ReportName YourReportName.Design name

3. For deploying all SSRS reports in a specific module.

K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "K:\AosService\PackagesLocalDirectory" -Module YourModuleName




Tuesday, January 13, 2026

How to handle DB restore error.

 ERROR;-
The transaction log for database 'AXDB_NewCON' is full due to 'ACTIVE_TRANSACTION'.

If this error occurs, it means that the highlighted drive has reached full capacity. To resolve the issue, disk space must be freed on that drive. Please follow the steps below to clean up the drive and make sufficient space available.


Go to the AXDB properties and select the recovery model as simple.


As the next step, right-click on the AXDB database, select Tasks, then choose Shrink, and finally click on Files.


After performing the shrink operation, the drive space will be freed.

After completing all the steps, we can change the recovery model back to its normal state.










How to Restore a UAT Database to a Development Environment in D365 Finance & Operations

 How to Restore a UAT Database to a Development Environment in D365 Finance & Operations 

Restoring a UAT database to a development environment is a common activity in D365 Finance & Operations (D365 FO). It helps developers analyze issues, test fixes, and validate customizations using real data. This blog explains how to restore a UAT database to a Dev environment using a BACPAC file downloaded from LCS. 

 
 

Step 1: Download the BACPAC File from LCS 

  1. Log in to Lifecycle Services (LCS). 

  2. Select the required UAT environment. 

  3. Navigate to the Maintain tab. 

  4. In the Maintain section, go to Database. 

  5. Click on the option to export or download the database. 

  6. Once the export is completed, download the BACPAC file to your local machine. 

The BACPAC file contains both the database schema and data. 

 
 

Step 2: Download and Install SqlPackage 

To restore the BACPAC file, we need the SqlPackage utility. 

  1. Download SqlPackage from Microsoft. 

  2. Since our operating system supports Windows, select the Windows package. 

  3. The downloaded file will be in ZIP format. 

  4. Extract the ZIP file. 

  5. Copy or note down the folder path where SqlPackage.exe is located. 

 

Running SqlPackage Command Using Command Prompt (Run as Administrator) 

Before restoring the database using SqlPackage, make sure to run the Command Prompt with administrator privileges. 


Step 1: Open Command Prompt as Administrator 

  1. Click on the Start menu. 

  2. Search for Command Prompt. 

  3. Right-click on Command Prompt. 

  4. Select Run as administrator. 

This ensures that SqlPackage has the required permissions to import the database. 

 
 

Step 2: Navigate to the SqlPackage Folder 

After opening Command Prompt as an administrator, navigate to the folder where SqlPackage.exe is located. 

Example: 

cd C:\Users\Admin6609cc02c0\Downloads\sqlpackage-win-x64-en-170.1.61.1  

Once executed, the Command Prompt path will change to the SqlPackage directory, as shown in the screenshot. 



Step 3: Restore the Database Using Command Prompt 

  1. Open Command Prompt (Run as Administrator). 

  2. Navigate to the folder where SqlPackage.exe is located, or use the full path in the command. 

  3. Execute the following command to restore the database on your Dev machine: 

SqlPackage.exe /a:Import  
/sf:D:\ExportedBacpac\MyUATDB.bacpac  
/tsn:localhost  
/tdn:AXDB_Dev  
/p:CommandTimeout=1200  
/TargetTrustServerCertificate:true 
 

 
 

Step 4: Command Parameter Explanation 

Parameter 

Description 

/a:Import 

Specifies the import action 

/sf 

Source file path (BACPAC file location) 

/tsn 

Target SQL Server name 

/tdn 

Target database name (must not already exist) 

/p:CommandTimeout 

Increases timeout for large databases 

/TargetTrustServerCertificate 

Trusts the SQL Server certificate 

⚠️ Make sure the target database does not already exist, otherwise the restore will fail. 


Once the database restore is completed, our custom database name will be changed accordingly. This change is required to align the restored database with the development environment configuration.


If you want to assign the required roles, please run the below script in SSMS.


CREATE USER axdeployuser FROM LOGIN axdeployuser

EXEC sp_addrolemember 'db_owner', 'axdeployuser'


CREATE USER axdbadmin FROM LOGIN axdbadmin

EXEC sp_addrolemember 'db_owner', 'axdbadmin'


CREATE USER axmrruntimeuser FROM LOGIN axmrruntimeuser

EXEC sp_addrolemember 'db_datareader', 'axmrruntimeuser'

EXEC sp_addrolemember 'db_datawriter', 'axmrruntimeuser'


CREATE USER axretaildatasyncuser FROM LOGIN axretaildatasyncuser


CREATE USER axretailruntimeuser FROM LOGIN axretailruntimeuser


CREATE USER axdeployextuser FROM LOGIN axdeployextuser


CREATE USER [NT AUTHORITY\NETWORK SERVICE] FROM LOGIN [NT AUTHORITY\NETWORK SERVICE]

EXEC sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK SERVICE'


UPDATE T1

SET T1.storageproviderid = 0

    , T1.accessinformation = ''

    , T1.modifiedby = 'Admin'

    , T1.modifieddatetime = getdate()

FROM docuvalue T1

WHERE T1.storageproviderid = 1 --Azure storage


DROP PROCEDURE IF EXISTS SP_ConfigureTablesForChangeTracking

DROP PROCEDURE IF EXISTS SP_ConfigureTablesForChangeTracking_V2

GO

-- Begin Refresh Retail FullText Catalogs

DECLARE @RFTXNAME NVARCHAR(MAX);

DECLARE @RFTXSQL NVARCHAR(MAX);

DECLARE retail_ftx CURSOR FOR

SELECT OBJECT_SCHEMA_NAME(object_id) + '.' + OBJECT_NAME(object_id) fullname FROM SYS.FULLTEXT_INDEXES

    WHERE FULLTEXT_CATALOG_ID = (SELECT TOP 1 FULLTEXT_CATALOG_ID FROM SYS.FULLTEXT_CATALOGS WHERE NAME = 'COMMERCEFULLTEXTCATALOG');

OPEN retail_ftx;

FETCH NEXT FROM retail_ftx INTO @RFTXNAME;


BEGIN TRY

    WHILE @@FETCH_STATUS = 0 

    BEGIN 

        PRINT 'Refreshing Full Text Index ' + @RFTXNAME;

        EXEC SP_FULLTEXT_TABLE @RFTXNAME, 'activate';

        SET @RFTXSQL = 'ALTER FULLTEXT INDEX ON ' + @RFTXNAME + ' START FULL POPULATION';

        EXEC SP_EXECUTESQL @RFTXSQL;

        FETCH NEXT FROM retail_ftx INTO @RFTXNAME;

    END

END TRY

BEGIN CATCH

    PRINT error_message()

END CATCH


CLOSE retail_ftx; 

DEALLOCATE retail_ftx; 

-- End Refresh Retail FullText Catalogs


--Begin create retail channel database record--

declare @ExpectedDatabaseName nvarchar(64) = 'Default';

declare @DefaultDataGroupRecId BIGINT;

declare @ExpectedDatabaseRecId BIGINT; 

IF NOT EXISTS (select 1 from RETAILCONNDATABASEPROFILE where NAME = @ExpectedDatabaseName)

BEGIN 

select @DefaultDataGroupRecId = RECID from RETAILCDXDATAGROUP where NAME = 'Default'; 

insert into RETAILCONNDATABASEPROFILE (DATAGROUP, NAME, CONNECTIONSTRING, DATASTORETYPE)

values (@DefaultDataGroupRecId, @ExpectedDatabaseName, NULL, 0); 

select @ExpectedDatabaseRecId = RECID from RETAILCONNDATABASEPROFILE where NAME = @ExpectedDatabaseName; 

insert into RETAILCDXDATASTORECHANNEL (CHANNEL, DATABASEPROFILE)

select RCT.RECID, @ExpectedDatabaseRecId from RETAILCHANNELTABLE RCT

inner join RETAILCHANNELTABLEEXT RCTEX on RCTEX.CHANNEL = RCT.RECID

        update RETAILCHANNELTABLEEXT set LIVECHANNELDATABASE = @ExpectedDatabaseRecId where LIVECHANNELDATABASE = 0

END; 

--End create retail channel database record


Stop the following 4 services

  • World Wide Web Publishing Service
  • Microsoft Dynamics 365 Unified Operations: Batch Management Service
  • Management Reporter 2012 Process Service
  • Microsoft Dynamics 365 Unified Operations: Data Import Export Framework Service 
5) Rename the DB.

2
3
4
5
6
ALTER DATABASE AXDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE AXDB MODIFY NAME = AXDB_Orig
GO
ALTER DATABASE AXDB_Orig SET MULTI_USER
GO

6) start the below  4 services 
  • World Wide Web Publishing Service
  • Microsoft Dynamics 365 Unified Operations: Batch Management Service
  • Management Reporter 2012 Process Service
  • Microsoft Dynamics 365 Unified Operations: Data Import Export Framework Service




JIT Access(Just In Time)

JIT access to TEST/UAT Just-in-time access which is required for various troubleshooting efforts, running unplanned queries, or data upgrade...