Azure BYOC Setup
This guide walks you through connecting your own Microsoft Azure subscription to Mengi Cloud as a BYOC (“Bring Your Own Cloud”) credential. When you use BYOC, Mengi provisions and manages a Kubernetes cluster (Azure AKS) inside your own Azure subscription, billed directly by Azure. Mengi only charges a management fee instead of the full infrastructure cost.
You will:
- Create a dedicated subscription for Mengi (the Azure isolation boundary).
- Register an app (service principal) in Microsoft Entra ID — a non-human identity for Mengi.
- Create a client secret for it.
- Assign it the Contributor role on the new subscription.
- Collect the four IDs/secrets Mengi needs.
- Store the credential in Mengi Cloud and create a cluster.
The whole process is done in the Azure portal — no CLI required.
What Mengi creates in your subscription
When you provision a BYOC cluster, Mengi creates the following in your subscription:
| Resource | Azure product |
|---|---|
| A resource group | Resource Manager |
| A virtual network and subnet | Virtual Network |
| An AKS managed Kubernetes cluster | AKS |
| A node pool (with optional autoscaling) | AKS / Virtual Machine Scale Sets |
The cluster’s nodes, load balancers and managed disks are created and billed in your subscription. You can delete everything at any time from the Mengi dashboard (which cleanly tears down the infrastructure) or from the Azure portal.
Azure’s managed Kubernetes (AKS) control plane is free — you pay only for the worker nodes and their attached resources.
Required permissions
The service principal Mengi uses needs to create a resource group, a virtual network and an AKS cluster, so it needs the Contributor role:
| Role | Why it’s needed |
|---|---|
Contributor | Create and manage the resource group, VNet, subnet, AKS cluster and node pool |
Scope & isolation:
Contributormust be assigned at the subscription scope. Mengi creates its own resource group (one per cluster), and creating a resource group is a subscription-level action — so scoping the role to a single pre-existing resource group will not work. On other providers you isolate Mengi inside a project (Scaleway, Hetzner, GCP); the Azure equivalent is a dedicated subscription. This guide therefore has you create a dedicated subscription for Mengi (Part 1, Step 1) and grantContributoron that subscription only, so the service principal can never touch the rest of your Azure estate.
Prerequisites
- An Azure account with a billing account / agreement (EA, MCA or pay-as-you-go) under which you can create a new subscription (AKS worker nodes incur Azure charges in that subscription).
- Permission to register applications in Microsoft Entra ID and to assign roles on the subscription (Owner or User Access Administrator).
Part 1 — Azure portal setup
1. Create a dedicated subscription
A separate subscription keeps Mengi’s resources isolated and makes access easy to scope and revoke — it is the Azure equivalent of a dedicated project.
- Sign in to the Azure portal and search for Subscriptions → Add (Create a subscription).
- Choose the Billing account, Billing profile and Invoice section you want the charges to land on, and pick the plan (e.g. Microsoft Azure Plan / Pay-as-you-go, or your EA/MCA plan).
- Name it e.g.
mengi-byocand click Review + create → Create. - Once created, open the subscription and copy the Subscription ID — you’ll need it later.
Creating a subscription requires billing-account rights. If your organization manages subscriptions centrally, ask whoever owns the billing account to create
mengi-byocfor you and give you Owner on it.
2. Register an application
- Open Microsoft Entra ID → App registrations → New registration.
- Name it e.g.
mengi-cloud-byoc, leave the defaults, and click Register. - On the app’s Overview page, copy these two values:
- Application (client) ID → this is your Client ID.
- Directory (tenant) ID → this is your Tenant ID.
3. Create a client secret
- On the app, open Certificates & secrets → Client secrets → New client secret.
- Add a description (e.g. “Mengi Cloud BYOC”) and choose an expiry.
- Click Add, then copy the secret Value immediately — it is shown only once (copy the Value, not the Secret ID). This is your Client Secret.
4. Assign the Contributor role on the subscription
- Open the
mengi-byocsubscription → Access control (IAM) → Add → Add role assignment. - On the Role tab, switch to the Privileged administrator roles sub-tab and select Contributor (description: “Grants full access to manage all resources…”). Don’t use the Job function roles tab — searching “Contributor” there returns dozens of service-specific ”… Contributor” roles and buries the plain one. Click Next.
- Under Members, choose Assign access to → User, group, or service
principal, click Select members, and pick the
mengi-cloud-byocapp. - Click Review + assign.
You now have the four values Mengi needs:
| Value | Where it came from |
|---|---|
| Client ID | App registration — Application (client) ID |
| Client Secret | Client secret — Value (shown once) |
| Tenant ID | App registration — Directory (tenant) ID |
| Subscription ID | The mengi-byoc subscription (Step 1) |
CLI alternative (Azure CLI)
If you prefer the Azure CLI, the whole
of Part 1 reduces to a couple of commands. Run az login first.
# 1. Create the dedicated subscription via the subscription-alias API.# BILLING_SCOPE points at your billing account / profile / invoice section# (MCA) or enrollment account (EA). List options with:# az billing account list -o tableaz account alias create \ --name mengi-byoc \ --display-name "mengi-byoc" \ --billing-scope "/providers/Microsoft.Billing/billingAccounts/<BA>/billingProfiles/<BP>/invoiceSections/<IS>" \ --workload Production
# Grab the new subscription IDSUBSCRIPTION_ID=$(az account subscription list \ --query "[?displayName=='mengi-byoc'].subscriptionId" -o tsv)
# 2-4. Register the app, create a service principal + client secret, and grant# Contributor scoped to ONLY the new subscription — all in one command.az ad sp create-for-rbac \ --name mengi-cloud-byoc \ --role Contributor \ --scopes "/subscriptions/$SUBSCRIPTION_ID"The az ad sp create-for-rbac output maps directly onto Mengi’s form:
| CLI output field | Mengi field |
|---|---|
appId | Client ID |
password | Client Secret |
tenant | Tenant ID |
$SUBSCRIPTION_ID | Subscription ID |
If you don’t have billing-account rights to create a subscription via the CLI, create
mengi-byocin the portal (Step 1) and run only theaz ad sp create-for-rbaccommand against its subscription ID.
Part 2 — Store the credential in Mengi Cloud
- Sign in to the Mengi Cloud dashboard and open Cloud Credentials from the left-hand menu.
- Click Add Credential.
- Fill in the form:
- Credential Name — any label, e.g.
azure-byoc. - Cloud Provider — select Microsoft Azure.
- Client ID — paste the Application (client) ID.
- Client Secret — paste the secret Value.
- Tenant ID — paste the Directory (tenant) ID.
- Subscription ID — paste the Subscription ID.
- Credential Name — any label, e.g.
- Click Add Credential.
The credential is stored encrypted and starts in Pending Validation. Mengi
validates it by acquiring an access token and reading the subscription; once that
succeeds the status turns to Ready. If it shows Invalid, re-check the
four values and that the Contributor role assignment has taken effect (it can
take a minute to propagate).
Part 3 — Create a BYOC cluster
Check your vCPU quota first. A brand-new subscription starts with a vCPU quota of 0 for many VM families, so cluster creation will fail with
QuotaExceededwhen AKS tries to create the node pool. Mengi’s node VMs use the Standard Bsv2 Family (e.g.Standard_B4s_v2, 4 vCPU per node). Before creating a cluster, open themengi-byocsubscription → Usage + quotas, filter for Standard Bsv2 Family vCPUs in your target region, and request an increase (at least 4 vCPU for a Dedicated cluster, 12+ for Dedicated HA). Quota increases are often auto-approved within minutes.
- Start a new cluster/deployment in the Mengi dashboard.
- Choose Azure as the provider and select a region (e.g.
eastus2,westus2,westeurope,northeurope). - Enable Use my own cloud account (BYOC) and select the
azure-byoccredential. - Pick a cluster type — Dedicated (1 node) or Dedicated HA (3 nodes, with SLA) — and create the cluster.
Mengi provisions the resource group, VNet, AKS control plane and node pool in
your subscription. The cluster moves through pending → provisioning → running.
Deleting it from Mengi tears the infrastructure back down in your subscription.
BYOC is not available on the Development type — those are virtual clusters on Mengi’s own shared host infrastructure. Use Dedicated or Dedicated HA.
Rotating the client secret
- In the Azure portal, create a new client secret for the
mengi-cloud-byocapp (Part 1, Step 2). - In Mengi, edit the
azure-byoccredential, paste the new secret Value, then re-validate. - Once the new secret is Ready, delete the old client secret in the portal.
Revoking access
To cut Mengi off entirely, delete the client secret (or the whole
mengi-cloud-byoc app registration), or remove its Contributor role
assignment. Delete any running BYOC clusters from the Mengi dashboard first
so the infrastructure is cleaned up — once access is gone, Mengi can no longer
tear those resources down for you.
Security notes
- The client secret Value is shown only once at creation — store it securely and never commit it to version control.
- Scope the role assignment to a single subscription or resource group so the principal can never touch the rest of your tenant.
- Mengi stores BYOC credentials encrypted, not in plaintext.
- Client secrets expire — set a calendar reminder to rotate before expiry.