Skip to content
Draft
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/adb2c/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

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

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

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

### Included Features ###
#### adb2c tenant ####
##### Create #####
```
az adb2c tenant create --location "United States" --properties display-name="Contoso" country-code="US" \
--name "Standard" --resource-group "contosoResourceGroup" --resource-name "contoso.onmicrosoft.com"
```
##### Show #####
```
az adb2c tenant show --resource-group "contosoResourceGroup" --resource-name "contoso.onmicrosoft.com"
```
##### List #####
```
az adb2c tenant list --resource-group "contosoResourceGroup"
```
##### Update #####
```
az adb2c tenant update --resource-group "contosoResourceGroup" --resource-name "contoso.onmicrosoft.com" \
--billing-type "MAU" --name "PremiumP1" --tags key="value"
```
##### Delete #####
```
az adb2c tenant delete --resource-group "rg1" --resource-name "contoso.onmicrosoft.com"
```
50 changes: 50 additions & 0 deletions src/adb2c/azext_adb2c/__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_adb2c.generated._help import helps # pylint: disable=unused-import
try:
from azext_adb2c.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


class CPIMConfigurationClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_adb2c.generated._client_factory import cf_adb2c_cl
adb2c_custom = CliCommandType(
operations_tmpl='azext_adb2c.custom#{}',
client_factory=cf_adb2c_cl)
parent = super(CPIMConfigurationClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=adb2c_custom)

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


COMMAND_LOADER_CLS = CPIMConfigurationClientCommandsLoader
17 changes: 17 additions & 0 deletions src/adb2c/azext_adb2c/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
4 changes: 4 additions & 0 deletions src/adb2c/azext_adb2c/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.15.0"
}
17 changes: 17 additions & 0 deletions src/adb2c/azext_adb2c/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/adb2c/azext_adb2c/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__)
20 changes: 20 additions & 0 deletions src/adb2c/azext_adb2c/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# 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_adb2c_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_adb2c.vendored_sdks.azureadb2c import CPIMConfigurationClient
return get_mgmt_service_client(cli_ctx,
CPIMConfigurationClient)


def cf_b2ctenant(cli_ctx, *_):
return cf_adb2c_cl(cli_ctx).b2_ctenants
83 changes: 83 additions & 0 deletions src/adb2c/azext_adb2c/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# --------------------------------------------------------------------------
# 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=too-many-lines

from knack.help_files import helps


helps['adb2c tenant'] = """
type: group
short-summary: Manage b2 c tenant with adb2c
"""

helps['adb2c tenant list'] = """
type: command
short-summary: "Get all the Azure AD B2C tenant resources in a resource group. And Get all the Azure AD B2C tenant \
resources in a subscription."
examples:
- name: B2CTenants_ListByResourceGroup
text: |-
az adb2c tenant list --resource-group "contosoResourceGroup"
- name: B2CTenants_ListBySubscription
text: |-
az adb2c tenant list
"""

helps['adb2c tenant show'] = """
type: command
short-summary: "Get the Azure AD B2C tenant resource."
examples:
- name: Get tenant
text: |-
az adb2c tenant show --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com"
"""

helps['adb2c tenant create'] = """
type: command
short-summary: "Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure \
resource linked to a subscription."
examples:
- name: Create tenant
text: |-
az adb2c tenant create --location "United States" --country-code "US" --display-name "Contoso" --sku \
"Standard" --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com"
"""

helps['adb2c tenant update'] = """
type: command
short-summary: "Update the Azure AD B2C tenant resource."
examples:
- name: Update tenant
text: |-
az adb2c tenant update --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" \
--billing-type "MAU" --sku "PremiumP1" --tags key="value"
"""

helps['adb2c tenant delete'] = """
type: command
short-summary: "Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource \
deletion can only happen as the last step in [the tenant deletion process](https://aka.ms/deleteB2Ctenant)."
examples:
- name: Delete tenant
text: |-
az adb2c tenant delete --resource-group "rg1" --name "contoso.onmicrosoft.com"
"""

helps['adb2c tenant wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the adb2c tenant is met.
examples:
- name: Pause executing next line of CLI script until the adb2c tenant is successfully created.
text: |-
az adb2c tenant wait --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" --created
- name: Pause executing next line of CLI script until the adb2c tenant is successfully deleted.
text: |-
az adb2c tenant wait --resource-group "contosoResourceGroup" --name "contoso.onmicrosoft.com" --deleted
"""
68 changes: 68 additions & 0 deletions src/adb2c/azext_adb2c/generated/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# --------------------------------------------------------------------------
# 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=too-many-lines
# pylint: disable=too-many-statements

from azure.cli.core.commands.parameters import (
tags_type,
get_enum_type,
resource_group_name_type,
get_location_type
)
from azure.cli.core.commands.validators import get_default_location_from_resource_group


def load_arguments(self, _):

with self.argument_context('adb2c tenant list') as c:
c.argument('resource_group_name', resource_group_name_type)

with self.argument_context('adb2c tenant show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C '
'tenant.', id_part='name')

with self.argument_context('adb2c tenant create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C '
'tenant.')
c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False,
validator=get_default_location_from_resource_group)
c.argument('tags', tags_type)
c.argument('name', options_list=['--sku'], arg_type=get_enum_type(['Standard', 'PremiumP1', 'PremiumP2']),
help='The name of the SKU for the tenant.', arg_group='Sku')
c.argument('display_name', type=str, help='The display name of the B2C tenant.', arg_group='Create Tenant '
'Properties')
c.argument('country_code', type=str, help='Country code of Azure tenant (e.g. \'US\'). Refer to '
'[aka.ms/B2CDataResidency](https://aka.ms/B2CDataResidency) to see valid country codes and '
'corresponding data residency locations. If you do not see a country code in an valid data '
'residency location, choose one from the list.', arg_group='Create Tenant Properties')

with self.argument_context('adb2c tenant update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C '
'tenant.', id_part='name')
c.argument('tags', tags_type)
c.argument('billing_type', arg_type=get_enum_type(['MAU', 'Auths']), help='The type of billing. Will be MAU '
'for all new customers. If \'Auths\', it can be updated to \'MAU\'. Cannot be changed if value is '
'\'MAU\'. Learn more about Azure AD B2C billing at [aka.ms/b2cBilling](https://aka.ms/b2cbilling).',
arg_group='Billing Config')
c.argument('name', options_list=['--sku'], arg_type=get_enum_type(['Standard', 'PremiumP1', 'PremiumP2']),
help='The name of the SKU for the tenant.', arg_group='Sku')

with self.argument_context('adb2c tenant delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C '
'tenant.', id_part='name')

with self.argument_context('adb2c tenant wait') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('resource_name', options_list=['--name'], type=str, help='The initial domain name of the B2C '
'tenant.', id_part='name')
9 changes: 9 additions & 0 deletions src/adb2c/azext_adb2c/generated/_validators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
10 changes: 10 additions & 0 deletions src/adb2c/azext_adb2c/generated/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# --------------------------------------------------------------------------
# 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=protected-access
32 changes: 32 additions & 0 deletions src/adb2c/azext_adb2c/generated/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# --------------------------------------------------------------------------
# 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=too-many-statements
# pylint: disable=too-many-locals

from azure.cli.core.commands import CliCommandType


def load_command_table(self, _):

from azext_adb2c.generated._client_factory import cf_b2ctenant
adb2c_b2ctenant = CliCommandType(
operations_tmpl='azext_adb2c.vendored_sdks.azureadb2c.operations._b2_ctenants_operations#B2CTenantsOperations.{'
'}',
client_factory=cf_b2ctenant)
with self.command_group('adb2c tenant', adb2c_b2ctenant, client_factory=cf_b2ctenant) as g:
g.custom_command('list', 'adb2c_tenant_list')
g.custom_show_command('show', 'adb2c_tenant_show')
g.custom_command('create', 'adb2c_tenant_create', supports_no_wait=True)
g.custom_command('update', 'adb2c_tenant_update')
g.custom_command('delete', 'adb2c_tenant_delete', supports_no_wait=True, confirmation=True)
g.custom_wait_command('wait', 'adb2c_tenant_show')

with self.command_group('adb2c', is_experimental=True):
pass
Loading