How to Export an On-Premises Distinguished Name to CSV from Azure AD
Question details
The user needs to export hybrid identity data, specifically on-premises distinguished names, into a CSV file format from the Azure Active Directory (Microsoft Entra) portal.

- Product
- Azure Active Directory (Microsoft Entra)
- Device & OS
- not provided
- Scenario
- Attempting to extract specific on-premises directory attributes to a CSV format for auditing or directory management.
- Observed behavior
- Requires specific PowerShell scripts or advanced portal procedures to accurately extract and export hybrid identity attributes.
Gather your exact directory attribute names, verify your Azure AD synchronization method, and note the portal location (Azure AD or Entra) before requesting a solution.
Consult the Microsoft Exchange Hybrid IT Pro Community
Because exporting specific hybrid identity data often requires custom PowerShell scripts, the best approach is to request a tailored solution from Microsoft experts.
Exporting standard user lists can be done directly in the portal, but extracting specific hybrid properties like the on-premises distinguished name usually requires advanced querying. The Microsoft Q&A community is equipped to provide the exact cmdlets or scripts needed for your environment.
Go to the Microsoft Q&A platform and navigate to the Office Exchange Hybrid IT Pro community.
Click 'Ask a question' to start a new thread detailing your need to export on-premises distinguished names.
Include the specific directory attribute name, your Active Directory synchronization method, the portal you are using, and your desired CSV format structure.
Once an expert provides the supported PowerShell procedure, run the commands in your Azure Cloud Shell or local PowerShell module connected to Entra ID to generate your CSV.

Easily Open and Analyze Exported CSV Files with WPS Office
Once you successfully export your Azure AD directory data into a CSV file, use WPS Office to open, filter, and analyze the records. WPS Office is a free, lightweight suite that handles large datasets effortlessly while maintaining seamless compatibility with Microsoft Office formats.
- 1. Download and Install: Download WPS Office Free from the official website and install it on your computer.
- 2. Open WPS Spreadsheet: Launch the WPS Office suite and select the Spreadsheet application.
- 3. Import the CSV File: Click 'File' > 'Open' and select the Azure AD CSV export to instantly view and format your directory data.

Frequently Asked Questions
Can I export all Azure AD users to a CSV directly from the admin portal?
Yes, you can export a general list of users to a CSV file from the 'All users' section in the Azure AD (Microsoft Entra) portal by clicking the 'Download users' button. However, highly specific hybrid attributes may not be included in this default report.
How do I open a CSV file without losing formatting or leading zeros?
Instead of double-clicking the CSV file, open a spreadsheet program like WPS Spreadsheet or Microsoft Excel first. Go to the Data tab and use the 'Import Data' feature, which allows you to set specific columns to 'Text' so leading zeros are preserved.
What is an on-premises distinguished name?
An on-premises distinguished name (DN) is a sequence of relative distinguished names that uniquely identifies an object within a local Active Directory domain structure, formatted similarly to CN=John Doe,OU=Users,DC=Company,DC=com.




