Model Context Protocol (MCP) finally gives AI models a way to access the business data needed to make them really useful at work. CData MCP Servers have the depth and performance to make sure AI has access to all of the answers.
Try them now for free →Automate Adobe Target Integration Tasks from PowerShell
Are you in search of a quick and easy way to access Adobe Target data from PowerShell? This article demonstrates how to utilize the Adobe Target Cmdlets for tasks like connecting to Adobe Target data, automating operations, downloading data, and more.
The CData Cmdlets for Adobe Target are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Adobe Target.
PowerShell Cmdlets or ADO.NET Provider?
The Cmdlets are not only a PowerShell interface to Adobe Target, but also an SQL interface; this tutorial shows how to use both to retrieve Adobe Target data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Adobe Target. To access Adobe Target data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Adobe Target.
Once you have acquired the necessary connection properties, accessing Adobe Target data in PowerShell can be enabled in three steps.
To connect to Adobe Target, you must provide the Tenant property along with OAuth connection properties mentioned below. Note that while other connection properties can influence processing behavior, they do not affect the ability to connect.
To determine your Tenant name:
- Log in to Adobe Experience. The URL will look similar to: "https://experience.adobe.com/#/@mycompanyname/preferences/general-section".
- Extract the value after the "/#/@". In this example, it is "mycompanyname".
- Set the Tenant connection property to that value.
User Accounts (OAuth)
You must set AuthScheme to OAuthClient for all user account flows.
Note: Adobe authentication via OAuth requires updating your token every two weeks.
All Applications
CData provides an embedded OAuth application that simplifies OAuth authentication. Alternatively, you can create a custom OAuth application. Review Creating a Custom OAuth App in the Help documentation for more information.Obtaining the OAuth Access Token
Set the following properties to connect:
- InitiateOAuth: Set to GETANDREFRESH to automatically perform the OAuth exchange and refresh the OAuthAccessToken as needed.
- OAuthClientId : Set to the client Id assigned when you registered your app.
- OAuthClientSecret : Set to the client secret assigned when you registered your app.
- CallbackURL : Set to the redirect URI defined when you registered your app. For example: https://localhost:3333
With these settings, the provider obtains an access token from Adobe Target, which it uses to request data. The OAuth values are stored in the location specified by OAuthSettingsLocation, ensuring they persist across connections.
PowerShell
-
Install the module:
Install-Module AdobeTargetCmdlets
-
Connect:
$adobetarget = Connect-AdobeTarget -Tenant "$Tenant"
-
Search for and retrieve data:
$type = "AB" $activities = Select-AdobeTarget -Connection $adobetarget -Table "Activities" -Where "Type = `'$Type`'" $activities
You can also use the Invoke-AdobeTarget cmdlet to execute SQL commands:
$activities = Invoke-AdobeTarget -Connection $adobetarget -Query 'SELECT * FROM Activities WHERE Type = @Type' -Params @{'@Type'='AB'}
ADO.NET
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Adobe Target\lib\System.Data.CData.AdobeTarget.dll") -
Connect to Adobe Target:
$conn= New-Object System.Data.CData.AdobeTarget.AdobeTargetConnection("Tenant=mycompanyname;InitiateOAuth=GETANDREFRESH") $conn.Open() -
Instantiate the AdobeTargetDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Id, Name from Activities" $da= New-Object System.Data.CData.AdobeTarget.AdobeTargetDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.id $_.name }