From 503258cd0e492f20a212fca28a8f68fe2f9abd76 Mon Sep 17 00:00:00 2001 From: xizha Date: Sat, 6 Apr 2019 18:04:12 -0700 Subject: [PATCH] bug fixes: missing service principal and network profile parameter validation --- src/aks-preview/azext_aks_preview/custom.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/aks-preview/azext_aks_preview/custom.py b/src/aks-preview/azext_aks_preview/custom.py index 849d4e98f9e..97aa49daaeb 100644 --- a/src/aks-preview/azext_aks_preview/custom.py +++ b/src/aks-preview/azext_aks_preview/custom.py @@ -450,7 +450,11 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint: if (vnet_subnet_id and not skip_subnet_role_assignment and not subnet_role_assignment_exists(cmd.cli_ctx, vnet_subnet_id)): scope = vnet_subnet_id - if not _add_role_assignment(cmd.cli_ctx, 'Network Contributor', service_principal, scope=scope): + if not _add_role_assignment( + cmd.cli_ctx, + 'Network Contributor', + service_principal_profile.client_id, + scope=scope): logger.warning('Could not create a role assignment for subnet. ' 'Are you an Owner on this subscription?') @@ -461,6 +465,10 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint: dns_service_ip, docker_bridge_address, network_policy]): + if not network_plugin: + raise CLIError('Please explicitly specify the network plugin type') + if pod_cidr and network_plugin == "azure": + raise CLIError('Please use kubenet as the network plugin type when pod_cidr is specified') network_profile = ContainerServiceNetworkProfile( network_plugin=network_plugin, pod_cidr=pod_cidr,