azure-cost-cli icon indicating copy to clipboard operation
azure-cost-cli copied to clipboard

How does --billing-account actually work?

Open DanielSpindler83 opened this issue 10 months ago • 12 comments

My billing account id is alpha numeric as per https://learn.microsoft.com/en-us/azure/cost-management-billing/manage/view-all-accounts

The variable used is an integer? public int? BillingAccountId { get; set; }

Perhaps we are not talking about the same billing account id?

Thanks,

Daniel

DanielSpindler83 avatar Feb 11 '25 07:02 DanielSpindler83

Thanks for opening your first issue! Reports like these help improve the project!

welcome[bot] avatar Feb 11 '25 07:02 welcome[bot]

If it only supports numeric billing accounts, then this is probably designed for EA accounts, which have numeric IDs. MCA accounts have more complex strings.

In theory, this should be a fairly simple change to support a string, but please do note that some dimensions in Query API are different between EA and MCA.

flanakin avatar Feb 16 '25 08:02 flanakin

The tool does not yet take MCA accounts into account. Which is tricky, as I do not have access to such an account and need to see how I can support the multiple types of accounts.

mivano avatar Feb 18 '25 22:02 mivano

@mivano are you discovering dimensions from the Dimensions API or do you have them hard-coded? If you discover, then switching to MCA should be as simple as supporting any scope. The dimensions are different with MCA, so that part is important.

flanakin avatar Mar 14 '25 07:03 flanakin

There is no discovery, so that would certainly be an option to explore. Thanks for the pointer!

mivano avatar Mar 14 '25 07:03 mivano

In version 0.45, the billingaccountid is a string instead of an integer. I m not able to test everything yet, so please provide feedback if that works now for you. Still exploring the dimensions API.

mivano avatar Mar 21 '25 10:03 mivano

Do you currently support or have plans to support CSP (Cloud Solution Provider) agreements in your cost analysis code? Specifically, we need to track Savings Plan benefits allocation across subscriptions under a CSP agreement, where we don't have the same level of management group visibility as with EA or MCA agreements.. You might already provide support for this, and I apologize if this is more appropriate in the discussions section, but it was hard to find information about what types you support.

jennybeate avatar Apr 14 '25 07:04 jennybeate

Do you currently support or have plans to support CSP (Cloud Solution Provider) agreements in your cost analysis code? Specifically, we need to track Savings Plan benefits allocation across subscriptions under a CSP agreement, where we don't have the same level of management group visibility as with EA or MCA agreements.. You might already provide support for this, and I apologize if this is more appropriate in the discussions section, but it was hard to find information about what types you support.

In the end, it is a call to the Azure Cost API, so that needs to support the subscription kind. See this overview of what is supported. There is no concept of CSP in the Azure Cost API, so when supported, it will just fetch the data as is.

mivano avatar Apr 15 '25 20:04 mivano

@mivano FYI: CSP is a subset of MCA. Once you add support for MCA, you'll also cover CSP.

flanakin avatar Apr 25 '25 07:04 flanakin

Thanks @flanakin, I will have to see how to get a MCA to test against.

mivano avatar Apr 25 '25 07:04 mivano

You may be able to get a free trial subscription. I believe those are all MCA now. I'm not 100% sure, tho 🤞

flanakin avatar Apr 25 '25 07:04 flanakin

But, fwiw, I would just build the EA functionality to work against Dimensions API and then release that with "experimental" support for MCA. Then be open with the community for others to help validate that, given it's difficult to get test accounts. I'm sure the community will understand 🙂 You're making their lives easier, so it's the least they can do for everything you're putting in to help everyone!

flanakin avatar Apr 25 '25 07:04 flanakin

Fair point! I will dive into that dimensions endpoint.

mivano avatar Apr 28 '25 19:04 mivano

Just a note that --billing-account is now running without error but not producing any actual results. All I get is: "Azure Cost Overview for Enrollment from 1/05/2025 to 21/05/2025" However I am running the tool with ONLY the --billing-account provided - which could be incorrect - I will investigate further and advise.

We have a MCA (Microsoft Customer Agreement). If you need specific testing against an MCA then I can help.

I will conduct further testing, analysis and triage and provide info.

DanielSpindler83 avatar May 21 '25 05:05 DanielSpindler83

maybe a silly question - but how should --billing-account be used and what is the intent and expected results? @mivano @flanakin

This may help as I work through what this is doing for MCA and I could update the doco to make --billing-account more clear on usage.

Currently I can see that it wont work for MCA as an enrollment id is expected and MCA differs from EA in this respect.

DanielSpindler83 avatar May 22 '25 06:05 DanielSpindler83

billing account now working for MCA after recent PR merge. Closing this issue.

DanielSpindler83 avatar Jun 29 '25 11:06 DanielSpindler83

Perfect, thanks!

mivano avatar Jun 29 '25 20:06 mivano