Azure Onboarding Process (script)

Connect Azure EA, MCA, or CSP partner billing accounts using the org-level Cloud Shell script and a client-secret wiv_account service principal.

Written By Dotan Cohen

Last updated About 10 hours ago

Connect Azure to Wiv using the Cloud Shell script. The script configures org-level billing access for Enterprise Agreement (EA), Microsoft Customer Agreement (MCA), and CSP partner billing accounts. Cost data is exported as daily FOCUS Parquet files to Blob storage.

Note: Prefer no client secret? Use Azure Onboarding Process (in-app wizard) or Generate Integration Link in Wiv.

Warning: This path requires a billing account visible to your login (EA, MCA, or CSP partner MCA). Customer tenants with no billing account cannot use this script.

Architecture

Billing account (EA / MCA / CSP partner)
        │
        ▼
  FOCUS daily export (Parquet/Snappy)
        │
        ▼
  Storage account in rg-wiv (shared key disabled)
        │
        ▼
  Wiv reads blobs directly

Prerequisites

  1. Billing agreement: EA, MCA, or CSP partner MCA.

  2. Tenant/billing admin rights to create app registrations, billing exports, and role assignments.

  3. Register Cloud Shell for your subscription.

  4. EA only: Enable Account owners can view charges under Cost Management + Billing → Policies.

What the script does

  1. Verifies az, curl, and python3.

  2. Creates or reuses the wiv_account app registration (client secret only for a new SP).

  3. Grants billing-account roles (Enrollment Reader for EA, Billing account reader for MCA/CSP).

  4. Assigns Reader, Monitoring Reader, and Cost Management Reader on every subscription under the billing account.

  5. Runs a Cost Management smoke test at billing-account scope.

  6. Creates a daily FOCUS export with system-assigned managed identity and secure Blob storage (allowSharedKeyAccess=false).

  7. Optionally assigns Reader + Monitoring Reader at a management group for metrics.

  8. Optionally grants Microsoft Graph User.Read.All and Group.Read.All.

Run the script

Open Azure Cloud Shell and run:

curl -sO https://raw.githubusercontent.com/wiv-ai/AzureOnBoarding/main/.cloudshell/startup.sh && chmod +x startup.sh && ./startup.sh

Prompt

What to enter

Host subscription ID

Subscription for rg-wiv and the app registration

Billing account Name

Resource name from the listed table

Smoke test

Press Enter after role grant (allow propagation time)

Azure region for rg-wiv

Region for billing storage (Enter for default)

Management group

Paste a name, or Enter to skip metrics

Graph permissions

y only if directory read access is required

Wait for the first export

The first FOCUS export can take 5–30 minutes. In the Azure portal, open the billing account → Exports → WivFocusDailyExportRun now, then confirm part_*.snappy.parquet files appear in storage.

Save the script output

Copy the Wiv integration secret JSON printed at the end of the script. It includes Tenant ID, App ID, Client Secret (new SP only), billing account name, billing storage account, host subscription ID, and export path defaults.

Connect in Wiv

  1. Sign in to Wiv → IntegrationsAzureNew Azure Integration.

  2. Enter values from the script output JSON: Tenant ID, App ID, Client Secret, Billing account name, Billing storage account, and host subscription ID (plus container / root / export name if you changed the defaults).

  3. Click Save.

Note: The script prints a ready-to-paste Wiv integration JSON at the end (auth_method client_secret, billing_query_backend blob).

Troubleshooting

Symptom

Action

No billing accounts listed

Sign in to the partner/EA/MCA tenant with billing admin rights

Smoke test 403

Wait for role propagation; for EA, confirm view-charges policy

Subscription missing in Wiv

Re-run script (per-sub grants) or assign ARM roles manually

Export create fails (shared key)

Re-run script — export uses managed identity

No cost data

Run Run now on WivFocusDailyExport

AADSTS700016 in workflows

Re-onboard — app registration was deleted or tenant ID is wrong