Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/billing/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Initial release.
202 changes: 202 additions & 0 deletions src/billing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
# Azure CLI billing Extension #
This is the extension for billing

### How to use ###
Install this extension using the below CLI command
```
az extension add --name billing
```

### Included Features ###
#### billing account ####
##### List #####
```
az billing account list
```
##### List #####
```
az billing account list --expand "soldTo,billingProfiles,billingProfiles/invoiceSections"
```
##### List #####
```
az billing account list --expand "enrollmentDetails,departments,enrollmentAccounts"
```
##### Show #####
```
az billing account show --expand "soldTo,billingProfiles,billingProfiles/invoiceSections" --name "{billingAccountName}"
```
##### Show #####
```
az billing account show --name "{billingAccountName}"
```
##### Update #####
```
az billing account update --name "{billingAccountName}" --display-name "Test Account" \
--sold-to address-line1="Test Address 1" city="Redmond" company-name="Contoso" country="US" first-name="Test" last-name="User" postal-code="12345" region="WA"
```
#### billing balance ####
##### Show #####
```
az billing balance show --account-name "{billingAccountName}" --profile-name "{billingProfileName}"
```
#### billing profile ####
##### Create #####
```
az billing profile create --account-name "{billingAccountName}" --name "{billingProfileName}" \
--bill-to address-line1="Test Address 1" city="Redmond" country="US" first-name="Test" last-name="User" postal-code="12345" region="WA" \
--display-name "Finance" --enabled-azure-plans sku-id="0001" --enabled-azure-plans sku-id="0002" \
--invoice-email-opt-in true --po-number "ABC12345"
```
##### List #####
```
az billing profile list --expand "invoiceSections" --account-name "{billingAccountName}"
```
##### Show #####
```
az billing profile show --account-name "{billingAccountName}" --name "{billingProfileName}"
```
##### Show #####
```
az billing profile show --expand "invoiceSections" --account-name "{billingAccountName}" --name "{billingProfileName}"
```
##### List #####
```
az billing profile list --account-name "{billingAccountName}"
```
#### billing customer ####
##### List #####
```
az billing customer list --account-name "{billingAccountName}" --profile-name "{billingProfileName}"
```
##### Show #####
```
az billing customer show --account-name "{billingAccountName}" --name "{customerName}"
```
##### Show #####
```
az billing customer show --expand "enabledAzurePlans,resellers" --account-name "{billingAccountName}" \
--name "{customerName}"
```
#### billing invoice section ####
##### Create #####
```
az billing invoice section create --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--name "{invoiceSectionName}" --display-name "invoiceSection1" --labels costCategory="Support" pcCode="A123456"
```
##### Show #####
```
az billing invoice section show --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--name "{invoiceSectionName}"
```
##### List #####
```
az billing invoice section list --account-name "{billingAccountName}" --profile-name "{billingProfileName}"
```
#### billing subscription ####
##### List #####
```
az billing subscription list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--invoice-section-name "{invoiceSectionName}"
```
##### Show #####
```
az billing subscription show --account-name "{billingAccountName}"
```
##### Update #####
```
az billing subscription update --account-name "{billingAccountName}" --cost-center "ABC1234"
```
##### Move #####
```
az billing subscription move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"
```
##### Validate-move #####
```
az billing subscription validate-move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"
```
##### Validate-move #####
```
az billing subscription validate-move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"
```
#### billing product ####
##### List #####
```
az billing product list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--invoice-section-name "{invoiceSectionName}"
```
##### Show #####
```
az billing product show --account-name "{billingAccountName}" --name "{productName}"
```
##### Update #####
```
az billing product update --account-name "{billingAccountName}" --auto-renew "Off" --name "{productName}"
```
##### Move #####
```
az billing product move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}" \
--name "{productName}"
```
##### Validate-move #####
```
az billing product validate-move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}" \
--name "{productName}"
```
##### Validate-move #####
```
az billing product validate-move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}" \
--name "{productName}"
```
#### billing invoice ####
##### List #####
```
az billing invoice list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--period-end-date "2018-06-30" --period-start-date "2018-01-01"
```
##### List #####
```
az billing invoice list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--period-end-date "2018-06-30" --period-start-date "2018-01-01"
```
##### Show #####
```
az billing invoice show --account-name "{billingAccountName}" --name "{invoiceName}"
```
##### Show #####
```
az billing invoice show --account-name "{billingAccountName}" --name "{invoiceName}"
```
##### Show #####
```
az billing invoice show --account-name "{billingAccountName}" --name "{invoiceName}"
```
##### Show #####
```
az billing invoice show --account-name "{billingAccountName}" --name "{invoiceName}"
```
#### billing transaction ####
##### List #####
```
az billing transaction list --account-name "{billingAccountName}" --invoice-name "{invoiceName}"
```
#### billing policy ####
##### Update #####
```
az billing policy update --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--marketplace-purchases "OnlyFreeAllowed" --reservation-purchases "NotAllowed" --view-charges "Allowed"
```
#### billing property ####
##### Show #####
```
az billing property show
```
##### Update #####
```
az billing property update --cost-center "1010"
```
50 changes: 50 additions & 0 deletions src/billing/azext_billing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_billing.generated._help import helps # pylint: disable=unused-import
try:
from azext_billing.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


class BillingManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_billing.generated._client_factory import cf_billing_cl
billing_custom = CliCommandType(
operations_tmpl='azext_billing.custom#{}',
client_factory=cf_billing_cl)
parent = super(BillingManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=billing_custom)

def load_command_table(self, args):
from azext_billing.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_billing.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from azext_billing.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_billing.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = BillingManagementClientCommandsLoader
17 changes: 17 additions & 0 deletions src/billing/azext_billing/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
3 changes: 3 additions & 0 deletions src/billing/azext_billing/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"azext.minCliCoreVersion": "2.11.0"
}
17 changes: 17 additions & 0 deletions src/billing/azext_billing/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
12 changes: 12 additions & 0 deletions src/billing/azext_billing/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
60 changes: 60 additions & 0 deletions src/billing/azext_billing/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------


def cf_billing_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.billing import BillingManagementClient
return get_mgmt_service_client(cli_ctx,
BillingManagementClient)


def cf_account(cli_ctx, *_):
return cf_billing_cl(cli_ctx).billing_account


def cf_balance(cli_ctx, *_):
return cf_billing_cl(cli_ctx).available_balance


def cf_profile(cli_ctx, *_):
return cf_billing_cl(cli_ctx).billing_profile


def cf_customer(cli_ctx, *_):
return cf_billing_cl(cli_ctx).customer


def cf_invoice_section(cli_ctx, *_):
return cf_billing_cl(cli_ctx).invoice_section


def cf_subscription(cli_ctx, *_):
return cf_billing_cl(cli_ctx).billing_subscription


def cf_product(cli_ctx, *_):
return cf_billing_cl(cli_ctx).product


def cf_invoice(cli_ctx, *_):
return cf_billing_cl(cli_ctx).invoice


def cf_transaction(cli_ctx, *_):
return cf_billing_cl(cli_ctx).transaction


def cf_policy(cli_ctx, *_):
return cf_billing_cl(cli_ctx).policy


def cf_property(cli_ctx, *_):
return cf_billing_cl(cli_ctx).billing_property
Loading