Overview
The Commitment Management setup script is the automated way to do Run the setup (steps A and B) for Azure Commitment Management. You copy one line from the nOps wizard into Azure Cloud Shell, and it downloads and runs the script. It sets up exactly what the portal steps set up, with the same template and names. Nothing more. Choose it in the wizard at Commitment Management → Run Setup → Run an Azure CLI script. The other choice, Step by step, is the portal walkthrough. Both end at the same place, and you can switch between them at any time.Use the script if
Use Step by step if
- Shows what it will do, and what your account is allowed to do, before it changes anything.
- Does every step your account can do, and skips the ones it can’t (it doesn’t fail on them).
- Ends with a numbered list of what is left. For each item it says who can do it, where in the Azure portal, and the exact command with your values filled in.
- Is safe to run again, on any day and by anyone. It checks each step, keeps what is already there, and never creates anything twice.
- Never changes a delegation that is already there, even one from an earlier nOps setup.
- Gives the nOps.io application no role at all. Purchasing access goes to nOps staff, through Azure Lighthouse, on the subscriptions you choose.
What the script sets up
nops-commitment-management) as Deploy to Azure and the Cloud Shell command in Step by step. You see it under Service providers in the Azure portal, where you can remove it at any time.
Exactly the same access as the manual setup
What the script never does
- It never changes an existing delegation. Redeploying a Lighthouse delegation replaces its roles, and some earlier nOps setups gave different roles. The script reports what such a delegation gives and prints the command that would update it, for you to decide. See Delegations already in place.
- It never turns a purchase policy off, and never changes any other policy setting. It reads the policies, changes only a purchase policy that is off, and writes every other setting back as it was. It prints the old values.
- It never deletes anything.
- It never buys anything. nOps staff buy later, in the Azure portal, through the delegation.
- It never stores or sends your Azure credentials. It runs as you, in your own Azure CLI session.
How it works
- You copy the command. nOps saves the script for your setup, built from what you entered in the wizard.
- You run it in your own Azure CLI session. The command downloads the script, saves it as
nops-azure-cm-setup.shand runs it. Every change is made by your account, so Azure’s activity log shows you made it. - The script reports each step’s result to nOps: done, skipped, needs another role, or the Azure error code with a one-line message. That’s all it sends. If nOps can’t be reached, setup carries on.
- nOps checks your tenant on its own, as the nOps.io application, with the read access it already has from Savings Analysis. The checklist ticks off the delegation and the purchase policies as Azure shows them.
- When both are in place, nOps runs Verify for you and turns Commitment Management on. Savings Analysis stays on the whole time.
One run, step by step
Before you start
Who should run it
The script does what the signed-in account is allowed to do. One person with both roles below finishes in one run. Otherwise, run it as one person, then have the next person run the same script. Steps already done are kept.Three ways to run it
What to check in nOps first
- Purchase subscriptions (step 1): one per billing profile you want nOps to buy for (one in total for EA). The script uses exactly these.
- Billing account ID (MCA, in Run Setup): filled in from Savings Analysis. The script uses it to find each subscription’s billing profile when step 1 doesn’t name one. Correct it there if it’s wrong; the change is used for the script only.
Run it
Open Run Setup
Optional: run the preview
Copy the curl command
curl command. You can also expand Read the script to see every line first. From now on, the nOps setup page watches your tenant.Paste it into Azure Cloud Shell
bash nops-azure-cm-setup.sh in the same Cloud Shell.Read the summary
nOps finishes on its own
Reading the output
- Setup is done. nOps finishes on its own.
- A numbered list. Each item says what is left, who can do it, the portal path, and the exact Azure CLI command with your values. Do them, or send the list to the person it names, then run the same script again.
Delegations already in place
Some customers have a delegation from an earlier nOps setup (“nOps FinOps Management (Dedicated Subscription)”). It has the same name in Azure as today’s delegation, and deploying the template again would replace its roles. So the script never redeploys one that is already there. It reads what the delegation gives nOps staff and:Running it again
Run it as often as you like: after fixing something by hand, as another person, or after adding a purchase subscription in step 1 (copy the command again so the script includes it). Every run:- reads the delegation on each purchase subscription and the purchase policies on each enrollment or billing profile before changing anything;
- keeps what is in place, and only does what is left;
- never deploys a delegation on a subscription that already has one with other roles;
- writes a purchase policy only when a purchase setting is off.
What the script sends to nOps
The same as the Savings Analysis script: for each step, done, skipped, needs another role, or failed, with the Azure error code and a one-line message. It sends no credentials, tokens, resource contents, cost data or personal data. The script and the one-line command use one single-purpose token. It can post step results for your integration and download the script you saved, nothing else. It expires after 3 days, and nOps stores it only as a hash. The preview never sends anything.Troubleshooting
Before any change is made
The command prints nothing, or curl reports an error (401, 404)
The command prints nothing, or curl reports an error (401, 404)
- 401: the command is more than 3 days old. Copy it again from nOps.
- 404: nOps hadn’t saved the script yet (the copy failed, or nOps showed an error under the command). Copy it again.
- No connection: the machine can’t reach nOps through a firewall or proxy. Use Azure Cloud Shell, or use Copy setup script or Download instead.
"The Azure CLI isn't installed here" or "needs 2.37 or later"
"The Azure CLI isn't installed here" or "needs 2.37 or later"
az upgrade)."You're signed in to tenant …, but nOps is connected to …"
"You're signed in to tenant …, but nOps is connected to …"
az login --tenant <the tenant ID the script shows>, then run the script again. In Cloud Shell, switch directory first (Cloud Shell → Settings → Switch directory)."Your Azure sign-in … has expired or needs to be renewed"
"Your Azure sign-in … has expired or needs to be renewed"
az login --tenant <your tenant ID> (it may ask for MFA), then run the script again."To build your script, add: …" in nOps
"To build your script, add: …" in nOps
During the steps
"… can't see purchase subscription …"
"… can't see purchase subscription …"
Delegation: [needs] Owner on that subscription
Delegation: [needs] Owner on that subscription
Delegation: [left] … needs both purchaser roles
Delegation: [left] … needs both purchaser roles
"Couldn't read which billing profile subscription … bills to"
"Couldn't read which billing profile subscription … bills to"
Purchase policies: [needs] Enterprise Administrator / billing profile owner
Purchase policies: [needs] Enterprise Administrator / billing profile owner
"… is "…". nOps left it alone; it must allow purchases."
"… is "…". nOps left it alone; it must allow purchases."
MissingSubscriptionRegistration
MissingSubscriptionRegistration
Microsoft.ManagedServices and retries on its own. If it still fails, run az provider register --namespace Microsoft.ManagedServices --subscription <id> --wait and run the script again.On the nOps setup page
The script said Setup is done, but the checklist hasn't moved
The script said Setup is done, but the checklist hasn't moved
Verify failed after the script finished
Verify failed after the script finished
Undoing the setup
- Delegation: in the Azure portal, open Service providers → Service provider offers, select nOps Commitment Management, and delete it, or ask nOps to remove it. Removing it stops nOps staff from buying through that subscription. Commitments already bought keep applying.
- Purchase policies: set them back under Cost Management + Billing → Billing scopes → the enrollment or billing profile → Policies. The script printed the old values when it changed them.
FAQs
Does the script buy anything?
Does the script buy anything?
Why does the script use Azure Lighthouse instead of a role for nOps.io?
Why does the script use Azure Lighthouse instead of a role for nOps.io?
Why one subscription per billing profile?
Why one subscription per billing profile?
Can I review the script before running it?
Can I review the script before running it?
nops-azure-cm-setup.sh after the command saves it. The preview makes no changes and lists exactly what would change.Can I run it in a pipeline?
Can I run it in a pipeline?
NOPS_SETUP_YES=1 to skip the question. Run the preview first and review its output in your change process.Does it change anything for Savings Analysis?
Does it change anything for Savings Analysis?