Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c6506f9
[image-copy] Fix copying images created from a blob (#1457)
tamirkamara Apr 17, 2020
d8e672e
EventGrid CLI Extension: 2020-04-01-preview bug fixes (#1538)
ahamad-MS Apr 20, 2020
29eb7ad
[Release] Update index.json for extension [ eventgrid ] (#1559)
Apr 20, 2020
f737485
fix tests due to network api version's change (#1563)
mmyyrroonn Apr 20, 2020
25e160b
created subscription extensions (#1202)
Apr 20, 2020
d9589f9
[Release] Update index.json for extension [ account ] (#1564)
Apr 20, 2020
660a5e5
Update table output for deployment and app (#1558)
yuwzho Apr 21, 2020
17b6c96
{image-copy} Update help (#1560)
qwordy Apr 21, 2020
09eecf8
[Support] Fix error message and added missing conditions (#1567)
mit2nil Apr 21, 2020
581cb60
[Breadth Coverage] Onboard Import Export (#1515)
arrownj Apr 22, 2020
54e0ed2
[Monitor]App byos and link la (#1499)
mmyyrroonn Apr 22, 2020
850f6aa
[Release] Update index.json for extension [ application-insights ] (#…
Apr 22, 2020
56a867c
[Release] Update index.json for extension [ support ] (#1569)
Apr 22, 2020
7a4d6db
create seagger_to_sdk_config.json
xiaoxuqi-ms Feb 28, 2020
cd84d74
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 2, 2020
53d6bc4
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 2, 2020
73e50f9
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 2, 2020
ee924b5
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 2, 2020
2a5b0cf
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 2, 2020
0c6f770
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 2, 2020
b5944bd
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 2, 2020
b994816
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 2, 2020
b59bfa5
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 3, 2020
3f79ba2
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 3, 2020
cfab113
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 6, 2020
bf190bc
Create build_package.py
xiaoxuqi-ms Mar 10, 2020
5c4f2e8
Update build_package.py
xiaoxuqi-ms Mar 10, 2020
22d442c
Update build_package.py
xiaoxuqi-ms Mar 10, 2020
5790204
Update build_package.py
xiaoxuqi-ms Mar 11, 2020
14a0d1e
Update build_package.py
xiaoxuqi-ms Mar 13, 2020
a6d4dfe
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 16, 2020
45858a2
Update swagger_to_sdk_config.json
xiaoxuqi-ms Mar 17, 2020
4ea8edf
Create readme.md
xiaoxuqi-ms Apr 16, 2020
052006f
move build_package to script
xiaoxuqi-ms Apr 16, 2020
a644d43
Update swagger_to_sdk_config.json
xiaoxuqi-ms Apr 16, 2020
dfec158
Generated from 4584062e25d7077cadbb1cbc4adf167b82151616
Apr 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,7 @@
/src/databox/ @jsntcy

/src/hpc-cache/ @qianwens

/src/import-export/ @arrownj

/src/account/ @zikalino
6 changes: 1 addition & 5 deletions scripts/automation/build_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ def create_package(name, dest_folder=DEFAULT_DEST_FOLDER):
check_call(['python', 'setup.py', "sdist", "--format", "zip", '-d', dest_folder], cwd=absdirpath)

if __name__ == '__main__':
"""
This file is used for Swagger CLI extension automation to build the wheel file and zip file
"""
parser = argparse.ArgumentParser(description='Build Azure package.')
parser.add_argument('name', help='The package name')
parser.add_argument('--dest', '-d', default=DEFAULT_DEST_FOLDER,
help='Destination folder. Relative to the package dir. [default: %(default)s]')
args = parser.parse_args()
create_package(args.name, args.dest)



8 changes: 8 additions & 0 deletions src/account/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

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

0.1.0
++++++
* Initial release.
5 changes: 5 additions & 0 deletions src/account/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Microsoft Azure CLI 'account' Extension
==========================================

This package is for the 'account' extension.
i.e. 'az account'
3 changes: 3 additions & 0 deletions src/account/azext_account/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
exclude =
vendored_sdks
41 changes: 41 additions & 0 deletions src/account/azext_account/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_account.generated._help import helps # pylint: disable=unused-import


class SubscriptionClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_account.generated._client_factory import cf_account
account_custom = CliCommandType(
operations_tmpl='azext_account.custom#{}',
client_factory=cf_account)
super(SubscriptionClientCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=account_custom)

def load_command_table(self, args):
from azext_account.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_account.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_account.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_account.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = SubscriptionClientCommandsLoader
13 changes: 13 additions & 0 deletions src/account/azext_account/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from azext_account.generated.action import * # noqa: F403
try:
from azext_account.manual.action import * # noqa: F403
except ImportError:
pass
4 changes: 4 additions & 0 deletions src/account/azext_account/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
}
13 changes: 13 additions & 0 deletions src/account/azext_account/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from azext_account.generated.custom import * # noqa: F403
try:
from azext_account.manual.custom import * # noqa: F403
except ImportError:
pass
4 changes: 4 additions & 0 deletions src/account/azext_account/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
24 changes: 24 additions & 0 deletions src/account/azext_account/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------


def cf_account(cli_ctx, *_):
from azure.cli.core.commands.client_factory import _get_mgmt_service_client
from ..vendored_sdks.subscription import SubscriptionClient
return _get_mgmt_service_client(cli_ctx, SubscriptionClient,
subscription_bound=False,
base_url_bound=False)[0]


def cf_subscription(cli_ctx, *_):
return cf_account(cli_ctx).subscription


def cf_subscription_operation(cli_ctx, *_):
return cf_account(cli_ctx).subscription_operation


def cf_operation(cli_ctx, *_):
return cf_account(cli_ctx).operation
80 changes: 80 additions & 0 deletions src/account/azext_account/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
# pylint: disable=too-many-lines

from knack.help_files import helps


helps['account subscription'] = """
type: group
short-summary: Manage subscriptions
"""

helps['account subscription create'] = """
type: command
short-summary: Create a new WebDirect or EA Azure subscription.
examples:
- name: Create subscription
text: |-
az account subscription create --billing-account-name \\
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_XXXX-XX-XX" \\
--billing-profile-name "27VR-HDWX-BG7-TGB" --cost-center "135366376" --display-name \\
"Contoso MCA subscription" --owner xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \\
--sku-id "0001" --invoice-section-name "JGF7-NSBG-PJA-TGB"
"""


helps['account subscription create-in-enrollment-account'] = """
type: command
short-summary: Create subscription in enrolment account
examples:
- name: Create subscription in enrollment account
text: |-
az account subscription create-in-enrollment-account --display-name \\
"Test Ea Azure Sub" --offer-type "MS-AZR-0017P" --owners \\
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \\
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --enrollment-account-name \\
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
"""

helps['account subscription create-csp'] = """
type: command
short-summary: Create a new CSP subscription.
examples:
- name: Create CSP subscription
text: |-
az account subscription create-csp --billing-account-name \\
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_XXXX-XX-XX" \\
--display-name "Contoso MCA subscription" --sku-id "0001" --customer-name \\
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
"""

helps['account subscription rename'] = """
type: command
short-summary: Rename subscription
examples:
- name: Rename subscription
text: |-
az account subscription rename --subscription-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
"""

helps['account subscription cancel'] = """
type: command
short-summary: Cancel subscription
examples:
- name: Cancel subscription
text: |-
az account subscription cancel --subscription-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
"""

helps['account subscription enable'] = """
type: command
short-summary: Enable subscription
examples:
- name: Enable subscription
text: |-
az account subscription enable --subscription-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
"""
48 changes: 48 additions & 0 deletions src/account/azext_account/generated/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements

from azure.cli.core.commands.parameters import (
get_enum_type
)


def load_arguments(self, _):

with self.argument_context('account subscription create') as c:
c.argument('billing_account_name', help='The name of the Microsoft Customer Agreement billing account for which you want to create the subscription.')
c.argument('billing_profile_name', help='The name of the billing profile in the billing account for which you want to create the subscription.')
c.argument('invoice_section_name', help='The name of the invoice section in the billing account for which you want to create the subscription.')
c.argument('display_name', help='The friendly name of the subscription.')
c.argument('sku_id', help='The SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest.')
c.argument('cost_center', help='If set, the cost center will show up on the Azure usage and charges file.')
c.argument('owner', help='Active Directory Principal who’ll get owner access on the new subscription.')
c.argument('management_group_id', help='The identifier of the management group to which this subscription will be associated.')

with self.argument_context('account subscription create-in-enrollment-account') as c:
c.argument('enrollment_account_name', help='The name of the enrollment account to which the subscription will be billed.')
c.argument('display_name', help='The display name of the subscription.')
c.argument('management_group_id', help='The Management Group Id.')
c.argument('owners', nargs='+', help='The list of principals that should be granted Owner access on the subscription. Principals should be of type User, Service Principal or Security Group.')
c.argument('offer_type', arg_type=get_enum_type(['MS-AZR-0017P', 'MS-AZR-0148P']), help='The offer type of the subscription. For example, MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement devTest) are available. Only valid when creating a subscription in a enrollment account scope.')

with self.argument_context('account subscription create-csp') as c:
c.argument('billing_account_name', help='The name of the Microsoft Customer Agreement billing account for which you want to create the subscription.')
c.argument('customer_name', help='The name of the customer.')
c.argument('display_name', help='The friendly name of the subscription.')
c.argument('sku_id', help='The SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest.')
c.argument('reseller_id', help='Reseller ID, basically MPN Id.')

with self.argument_context('account subscription rename') as c:
c.argument('subscription_id', help='Subscription Id.')
c.argument('subscription_name', help='New subscription name')

with self.argument_context('account subscription cancel') as c:
c.argument('subscription_id', help='Subscription Id.')

with self.argument_context('account subscription enable') as c:
c.argument('subscription_id', help='Subscription Id.')
4 changes: 4 additions & 0 deletions src/account/azext_account/generated/_validators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
4 changes: 4 additions & 0 deletions src/account/azext_account/generated/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
25 changes: 25 additions & 0 deletions src/account/azext_account/generated/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals
from azure.cli.core.commands import CliCommandType


def load_command_table(self, _):

from azext_account.generated._client_factory import cf_subscription
account_subscription = CliCommandType(
operations_tmpl='azext_account.vendored_sdks.subscription.operations._subscription_operations#SubscriptionOperations.{}',
client_factory=cf_subscription)
with self.command_group('account subscription', account_subscription, client_factory=cf_subscription) as g:
g.custom_command('create', 'account_subscription_create_subscription', supports_no_wait=True)
g.custom_command('rename', 'account_subscription_rename')
g.custom_command('cancel', 'account_subscription_cancel', confirmation=True)
g.custom_command('enable', 'account_subscription_enable')
g.custom_command('create-csp', 'account_subscription_create_csp_subscription', supports_no_wait=True)
g.custom_command('create-in-enrollment-account', 'account_subscription_create_subscription_in_enrollment_account', supports_no_wait=True)
76 changes: 76 additions & 0 deletions src/account/azext_account/generated/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
# pylint: disable=too-many-statements
# pylint: disable=too-many-lines
# pylint: disable=too-many-locals
# pylint: disable=unused-argument

from azure.cli.core.util import sdk_no_wait


def account_subscription_create_subscription(cmd, client,
billing_account_name,
billing_profile_name,
invoice_section_name,
display_name,
sku_id,
cost_center=None,
owner=None,
management_group_id=None,
no_wait=False):

body = {}
body['display_name'] = display_name
body['sku_id'] = sku_id
body['cost_center'] = cost_center
body['owner'] = {'object_id': owner}
body['management_group_id'] = management_group_id
return sdk_no_wait(no_wait, client.create_subscription, billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, invoice_section_name=invoice_section_name, body=body)


def account_subscription_create_subscription_in_enrollment_account(cmd, client,
enrollment_account_name,
display_name=None,
management_group_id=None,
owners=None,
offer_type=None,
no_wait=False):
if owners is not None:
owners = [{'object_id': x} for x in owners]

body = {}
body['display_name'] = display_name
body['management_group_id'] = management_group_id
body['owners'] = owners
body['offer_type'] = offer_type
return sdk_no_wait(no_wait, client.create_subscription_in_enrollment_account, enrollment_account_name=enrollment_account_name, body=body)


def account_subscription_create_csp_subscription(cmd, client,
billing_account_name,
customer_name,
display_name,
sku_id,
reseller_id=None,
no_wait=False):
body = {}
body['display_name'] = display_name
body['sku_id'] = sku_id
body['reseller_id'] = reseller_id
return sdk_no_wait(no_wait, client.create_csp_subscription, billing_account_name=billing_account_name, customer_name=customer_name, body=body)


def account_subscription_rename(cmd, client, subscription_id,
subscription_name=None):
return client.rename(subscription_id=subscription_id, subscription_name=subscription_name)


def account_subscription_cancel(cmd, client, subscription_id):
return client.cancel(subscription_id=subscription_id)


def account_subscription_enable(cmd, client, subscription_id):
return client.enable(subscription_id=subscription_id)
Loading