Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →How to pipe Azure DevOps Data to CSV in PowerShell
Use standard PowerShell cmdlets to access Azure DevOps tables.
The CData Cmdlets Module for Azure DevOps is a standard PowerShell module offering straightforward integration with Azure DevOps. Below, you will find examples of using our AzureDevOps Cmdlets with native PowerShell cmdlets.
Creating a Connection to Your Azure DevOps Data
You can connect to your Azure DevOps account by providing the Organization and PersonalAccessToken.
Obtaining a Personal Access Token
A PersonalAccessToken is necessary for account authentication.To generate one, log in to your Azure DevOps Organization account and navigate to Profile -> Personal Access Tokens -> New Token. The generated token will be displayed.
If you wish to authenticate to Azure DevOps using OAuth refer to the online Help documentation for an authentication guide.
$conn = Connect-AzureDevOps -AuthScheme "$AuthScheme" -Organization "$Organization" -ProjectId "$ProjectId" -PersonalAccessToken "$PersonalAccessToken"
Selecting Data
Follow the steps below to retrieve data from the Builds table and pipe the result into to a CSV file:
Select-AzureDevOps -Connection $conn -Table Builds | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myBuildsData.csv -NoTypeInformation
You will notice that we piped the results from Select-AzureDevOps into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.
The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.