![]()
Microsoft Dataverse provides a structured data storage system for Power Platform applications. Using PowerShell, you can list all tables (entities) available in a Dataverse environment to manage and interact with the data efficiently.
This guide walks you through the step-by-step process to list all tables in Dataverse using PowerShell.
Step 1: Prerequisites
1. Required Permissions
- You must have Global Admin, Power Platform Admin, or System Administrator roles.
- API access must be enabled in your Dataverse environment.
2. Install and Import PowerShell Modules
Run the following commands to install and import the required modules:
# Install Microsoft Power Platform Administration module
Install-Module -Name Microsoft.PowerPlatform.Administration -Scope CurrentUser -Force
# Install Microsoft Dataverse Client module
Install-Module -Name Microsoft.PowerPlatform.Cds.Client -Scope CurrentUser -Force
# Import the modules
Import-Module Microsoft.PowerPlatform.Administration
Import-Module Microsoft.PowerPlatform.Cds.Client
Step 2: Connect to Dataverse
To interact with Dataverse, you need to authenticate using PowerShell.
Option 1: Interactive Login (Prompt for Credentials)
# Connect to Dataverse interactively
$connection = Connect-CdsService -ConnectionString "AuthType=OAuth;Url=https://yourorg.crm.dynamics.com;Prompt=Login"
You will be prompted to enter your Microsoft 365 admin credentials.
Option 2: Connect Using Service Principal (App Registration)
For automation, use an Azure AD App Registration with a client secret.
# Define connection details
$clientId = "your-app-client-id"
$clientSecret = "your-app-client-secret"
$tenantId = "your-tenant-id"
$orgUrl = "https://yourorg.crm.dynamics.com"
# Create authentication context
$secureSecret = ConvertTo-SecureString $clientSecret -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential ($clientId, $secureSecret)
# Connect to Dataverse
$connection = Connect-CdsService -Url $orgUrl -ClientId $clientId -ClientSecret $secureSecret -TenantId $tenantId
Step 3: List All Tables in Dataverse
1. Retrieve All Tables
# Fetch all Dataverse tables
$tables = Get-CdsTable -Connection $connection
# Display table names
$tables | Select-Object LogicalName, DisplayName
2. Display Tables in a Table Format
# List all tables in a formatted view
$tables | Format-Table LogicalName, DisplayName -AutoSize
Step 4: Filter Specific Tables
1. Find Tables Containing a Specific Word
Example: List all tables related to accounts.
# Filter tables with 'account' in their name
$tables | Where-Object { $_.LogicalName -like "*account*" } | Select-Object LogicalName, DisplayName
2. List Only Custom Tables
Custom tables in Dataverse have names prefixed with “new_” or a custom publisher prefix.
# Filter custom tables
$customTables = $tables | Where-Object { $_.LogicalName -like "new_*" }
$customTables | Format-Table LogicalName, DisplayName -AutoSize
3. Find System Tables Only
To list only system tables, exclude those with “new_” or custom prefixes.
# Filter system tables
$systemTables = $tables | Where-Object { $_.LogicalName -notlike "new_*" }
$systemTables | Format-Table LogicalName, DisplayName -AutoSize
Step 5: Export Table List to CSV or Excel
1. Export to CSV
# Export Dataverse tables to CSV
$tables | Export-Csv -Path "C:\Dataverse_Tables.csv" -NoTypeInformation
Write-Host "Dataverse tables exported to C:\Dataverse_Tables.csv"
2. Export to Excel
# Install Excel module if not installed
Install-Module -Name ImportExcel -Scope CurrentUser -Force
# Export to Excel
$tables | Export-Excel -Path "C:\Dataverse_Tables.xlsx" -WorksheetName "Tables"
Write-Host "Dataverse tables exported to C:\Dataverse_Tables.xlsx"
Step 6: Disconnect from Dataverse
After retrieving and exporting the tables, disconnect the session.
Disconnect-CdsService -Connection $connection
Write-Host "Disconnected from Dataverse."
