Microsoft Ads
The microsoft_ads connector reads reports and entities from the Microsoft
Advertising API. It follows the same declarative shape as every StreamWright connector.
Auth
source.yaml
spec:
config:
account_id: { type: string }
secrets:
microsoft_ads_credentials: { type: string } # OAuth + developer token (one secret)
auth:
provider: microsoft_ads
account_id: "{{ config.account_id }}"
credentials: "{{ secrets.microsoft_ads_credentials }}"
Reading data
streams/campaigns.yaml
requests:
- name: raw_campaign_performance
sdk: microsoft_ads
service: ReportingService
method: report
arguments:
report: CampaignPerformance
columns: [AccountId, CampaignId, CampaignName, Impressions, Clicks, Spend]
window: { from: "{{ window.start }}", to: "{{ window.end }}" }
transform:
mode: page
steps:
- name: campaigns
select: |
SELECT
record->>'AccountId' AS account_id,
record->>'CampaignId' AS campaign_id,
record->>'CampaignName' AS campaign_name,
coalesce((record->>'Impressions')::BIGINT, 0) AS impressions,
coalesce((record->>'Clicks')::BIGINT, 0) AS clicks,
coalesce((record->>'Spend')::DOUBLE, 0) AS spend
FROM raw_campaign_performance
export:
campaigns:
step: campaigns
primary_key: [account_id, campaign_id]
Reference streams (examples)
The starter template (examples/sources/ads/microsoft_ads) includes the following reference streams:
| Stream | Description | Service / Report |
|---|---|---|
campaigns | Campaign settings, budgets, and statuses | CampaignManagementService |
ad_groups | Ad groups within campaigns | CampaignManagementService |
ad_group_tree | Multi-request hierarchy linking campaigns with child ad groups | CampaignManagementService |
campaign_performance | Daily delivery metrics (impressions, clicks, spend) | ReportingService (CampaignPerformance) |
keywords | Targeted keywords, match types, and bids | CampaignManagementService |
audience_targets | Remarketing lists and audience associations | CampaignManagementService |
location_targets | Geographic target criteria | CampaignManagementService |
Customizable Streams
These streams are reference examples. Because streams in StreamWright are declarative, you can customize columns, add additional SOAP entities or reports, or adjust DuckDB SQL transformations to fit your needs.
Shared vocabulary
microsoft_ads maps its streams to the same canonical nodes
as the other ad networks, so one pipeline covers all three.
See the connector's folder in the repo for the full option list and exact credential fields.