Skip to content
Merged
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
17 changes: 17 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@
- name: --enable-encryption-at-host
type: bool
short-summary: Enable EncryptionAtHost, default value is false.
- name: --enable-azure-rbac
type: bool
short-summary: Enable Azure RBAC to control authorization checks on cluster.
examples:
- name: Create a Kubernetes cluster with an existing SSH public key.
text: az aks create -g MyResourceGroup -n MyManagedCluster --ssh-key-value /path/to/publickey
Expand Down Expand Up @@ -479,6 +482,8 @@
text: az aks create -g MyResourceGroup -n MyManagedCluster --node-osdisk-type Ephemeral --node-osdisk-size 48
- name: Create a kubernetes cluster with EncryptionAtHost enabled.
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-encryption-at-host
- name: Create a kubernetes cluster with Azure RBAC enabled.
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-aad --enable-azure-rbac
"""

helps['aks update'] = """
Expand Down Expand Up @@ -570,6 +575,12 @@
- name: --assign-identity
type: string
short-summary: Specify an existing user assigned identity to manage cluster resource group.
- name: --enable-azure-rbac
type: bool
short-summary: Enable Azure RBAC to control authorization checks on cluster.
- name: --disable-azure-rbac
type: bool
short-summary: Disable Azure RBAC to control authorization checks on cluster.
examples:
- name: Update a kubernetes cluster with standard SKU load balancer to use two AKS created IPs for the load balancer outbound connection usage.
text: az aks update -g MyResourceGroup -n MyManagedCluster --load-balancer-managed-outbound-ip-count 2
Expand Down Expand Up @@ -601,6 +612,12 @@
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-managed-identity
- name: Update the cluster to use user assigned managed identity in control plane.
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-managed-identity --assign-identity <user_assigned_identity_resource_id>
- name: Update a non managed AAD AKS cluster to use Azure RBAC
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-aad --enable-azure-rbac
- name: Update a managed AAD AKS cluster to use Azure RBAC
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-azure-rbac
- name: Disable Azure RBAC in a managed AAD AKS cluster
text: az aks update -g MyResourceGroup -n MyManagedCluster --disable-azure-rbac
"""

helps['aks delete'] = """
Expand Down
32 changes: 27 additions & 5 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,8 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
enable_sgxquotehelper=False,
enable_encryption_at_host=False,
no_wait=False,
yes=False):
yes=False,
enable_azure_rbac=False):
_validate_ssh_key(no_ssh_key, ssh_key_value)
subscription_id = get_subscription_id(cmd.cli_ctx)
if dns_name_prefix and fqdn_subdomain:
Expand Down Expand Up @@ -2207,13 +2208,21 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
if any([aad_client_app_id, aad_server_app_id, aad_server_app_secret]):
raise CLIError('"--enable-aad" cannot be used together with '
'"--aad-client-app-id/--aad-server-app-id/--aad-server-app-secret"')
if disable_rbac and enable_azure_rbac:
raise ArgumentUsageError(
'"--enable-azure-rbac" can not be used together with "--disable-rbac"')
aad_profile = ManagedClusterAADProfile(
managed=True,
enable_azure_rbac=enable_azure_rbac,
admin_group_object_ids=_parse_comma_separated_list(
aad_admin_group_object_ids),
tenant_id=aad_tenant_id
)
else:
if enable_azure_rbac is True:
raise ArgumentUsageError(
'"--enable-azure-rbac" can only be used together with "--enable-aad"')

if any([aad_client_app_id, aad_server_app_id, aad_server_app_secret, aad_tenant_id]):
if aad_tenant_id is None:
profile = Profile(cli_ctx=cmd.cli_ctx)
Expand Down Expand Up @@ -2560,7 +2569,9 @@ def aks_update(cmd, client, resource_group_name, name,
enable_managed_identity=False,
assign_identity=None,
yes=False,
no_wait=False):
no_wait=False,
enable_azure_rbac=False,
disable_azure_rbac=False):
update_autoscaler = enable_cluster_autoscaler + \
disable_cluster_autoscaler + update_cluster_autoscaler
update_lb_profile = is_load_balancer_profile_provided(load_balancer_managed_outbound_ip_count,
Expand All @@ -2569,7 +2580,8 @@ def aks_update(cmd, client, resource_group_name, name,
load_balancer_outbound_ports,
load_balancer_idle_timeout)
update_aad_profile = not (
aad_tenant_id is None and aad_admin_group_object_ids is None)
aad_tenant_id is None and aad_admin_group_object_ids is None and
not enable_azure_rbac and not disable_azure_rbac)
# pylint: disable=too-many-boolean-expressions
if (update_autoscaler != 1 and cluster_autoscaler_profile is None and
not update_lb_profile and
Expand Down Expand Up @@ -2605,7 +2617,9 @@ def aks_update(cmd, client, resource_group_name, name,
'"--disable-ahub" or '
'"--windows-admin-password" or '
'"--enable-managed-identity" or '
'"--assign-identity"')
'"--assign-identity" or '
'"--enable-azure-rbac" or '
'"--disable-azure-rbac"')

if not enable_managed_identity and assign_identity:
raise CLIError(
Expand Down Expand Up @@ -2725,13 +2739,21 @@ def aks_update(cmd, client, resource_group_name, name,
)
if update_aad_profile:
if instance.aad_profile is None or not instance.aad_profile.managed:
raise CLIError('Cannot specify "--aad-tenant-id/--aad-admin-group-object-ids"'
raise CLIError('Cannot specify "--aad-tenant-id/--aad-admin-group-object-ids/"'
'"--enable-azure-rbac/--disable-azure-rbac"'
' if managed AAD is not enabled')
if aad_tenant_id is not None:
instance.aad_profile.tenant_id = aad_tenant_id
if aad_admin_group_object_ids is not None:
instance.aad_profile.admin_group_object_ids = _parse_comma_separated_list(
aad_admin_group_object_ids)
if enable_azure_rbac and disable_azure_rbac:
raise MutuallyExclusiveArgumentError(
'Cannot specify "--enable-azure-rbac" and "--disable-azure-rbac" at the same time')
if enable_azure_rbac:
instance.aad_profile.enable_azure_rbac = True
if disable_azure_rbac:
instance.aad_profile.enable_azure_rbac = False

if enable_ahub and disable_ahub:
raise CLIError(
Expand Down
Loading