Azure / Azure/azure-cli

`az costmanagement export`: what is the scope of a billing profile?

Open
#29,673 3 comments 0 reactions 0 assignees View on GitHub
Auto-Assign Auto-Resolve Cost Management customer-reported question Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

All of the documentation (e.g., [here](https://learn.microsoft.com/en-us/cli/azure/costmanagement/export?view=azure-cli-latest#az-costmanagement-export-list-examples)) as well as the CLI `az costmanagement` itself, lacks any documentation about how to specify a billing profile as a scope for creating/listing/etc. billing exports.

E.g., the docs document, subs, management groups, and _even resource groups_… but not a billing profile.

### Related command

```sh
az costmanagement export list --scope ???
```

I've tried using the "id" of a billing profile, i.e., `/providers/Microsoft.Billing/billingAccounts/$acct_id/billingProfiles/$profile_id`, but that doesn't seem to work. (It doesn't error, but it doesn't seem to work; I have an export under that profile, but the command returns `[]`.)

### Errors

N/A

### Issue script & Debug output

```
az costmanagement export list --scope
```

### Expected behavior

To be able to supply a billing profile to the commands under `az costmanagement export`.

### Environment Summary

```
» az --version
azure-cli 2.59.0 *

core 2.59.0 *
telemetry 1.1.0

Extensions:
automation 1.0.0b1
costmanagement 0.3.0
databricks 0.10.2
ssh 2.0.3

Dependencies:
msal 1.27.0
azure-mgmt-resource 23.1.0b2

Python location '/usr/local/Cellar/azure-cli/2.59.0/libexec/bin/python'
Extensions directory '/Users/roy/.azure/cliextensions'

Python (Darwin) 3.11.8 (main, Feb 6 2024, 21:21:21) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Legal docs and information: aka.ms/AzureCliLegal

You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade'
```

### Additional context

:face_exhaling: Exporting _the bill_ — the entire bill — seems like _the_ use case. Like, the first, and the biggest, use case. A billing profile is, AFAICT, the object that corresponds to that.

(Perhaps the _right_ management group might, too, if you have everything under one. But my security team is also loathe to grant privs to things above subs/tenants in that hierarchy. But the separate billing hierarchy is easier to request access to.)

(I ended up creating the export via the Portal UI, though even there I'm not able to get it to export to the storage account I want, which is in a different subscription than the subscription with the billing profile.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.