Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KeyVault] Add new parameter --enable-rbac-authorization during creating or updating #12074

Merged
merged 9 commits into from
Apr 22, 2020

Conversation

bim-msft
Copy link
Contributor

@bim-msft bim-msft commented Feb 6, 2020

Support for #11268

  • Waiting for Swagger/Python SDK, release time: Apr 15.
  • Waiting for service public.

How to test:

  1. Run az keyvault create -n {} -g {} --enable-rbac-authorization
  2. Check the value of properties.enableRbacAuthorization

This checklist is used to make sure that common guidelines for a pull request are followed.

Comment on lines 217 to 228
AZURE_DF_CLOUD = Cloud(
'AzureDFCloud',
endpoints=CloudEndpoints(
management='https://management-preview.core.windows-int.net/',
resource_manager='https://api-dogfood.resources.windows-int.net/',
gallery='https://df.gallery.azure-test.net/',
active_directory='https://login.windows-ppe.net',
active_directory_graph_resource_id='https://graph.ppe.windows.net/',
active_directory_resource_id='https://management.core.windows.net/',
microsoft_graph_resource_id='https://graph.ppe.windows.net/'),
suffixes=CloudSuffixes(
keyvault_dns='.vault-int.azure-int.net'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer not to hard-code our testing environment in the public CLI code. We can register a new cloud instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer not to hard-code our testing environment in the public CLI code. We can register a new cloud instead.

Good idea, I'll deprecate this part.

@@ -453,6 +460,10 @@ def set_policy(cmd, client, resource_group_name, vault_name,
object_id = _object_id_args_helper(cmd.cli_ctx, object_id, spn, upn)
vault = client.get(resource_group_name=resource_group_name,
vault_name=vault_name)

if vault.properties.enable_rbac_authorization:
raise CLIError('Cannot set policies to a vault with `--enable-rbac-authorization` specified')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keyvault may be created via Azure Portal, so customer may not used --enable-rbac-authorization to enable RBAC authorization. So how about using

Cannot set policies for a vault with RBAC authorization enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keyvault may be created via Azure Portal, so customer may not used --enable-rbac-authorization to enable RBAC authorization. So how about using

Cannot set policies for a vault with RBAC authorization enabled

Agree, this is more reasonable, will refine it.

@@ -453,6 +460,10 @@ def set_policy(cmd, client, resource_group_name, vault_name,
object_id = _object_id_args_helper(cmd.cli_ctx, object_id, spn, upn)
vault = client.get(resource_group_name=resource_group_name,
vault_name=vault_name)

if vault.properties.enable_rbac_authorization:
raise CLIError('Cannot set policies to a vault with `--enable-rbac-authorization` specified')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In error message we usually use single quote '. Grave accent ` is only for markdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In error message we usually use single quote '. Grave accent ` is only for markdown.

Good point, will refine this.

@yonzhan yonzhan added this to the S169 - For Build milestone Apr 11, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 11, 2020

add to S169

@@ -113,7 +113,7 @@
helps['keyvault create'] = """
type: command
short-summary: Create a key vault.
long-summary: Default permissions are created for the current user or service principal unless the `--no-self-perms` flag is specified.
long-summary: If `--enable-rbac-authorization` is not specified, then default permissions are created for the current user or service principal unless the `--no-self-perms` flag is specified.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long summary is not shown in CLI reference. May you can move it to short summary.

Copy link
Contributor Author

@bim-msft bim-msft Apr 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long summary is not shown in CLI reference. May you can move it to short summary.

@qwordy Good point, but I think it's ok to keep it as long summary, for the docs display issue, we'd better push docs team to display our long summaries as well. Now at least we can see the long summary using -h.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. No problem.

@bim-msft
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@bim-msft bim-msft merged commit 89cf88c into Azure:dev Apr 22, 2020
@bim-msft bim-msft deleted the bim_kv_rbac branch April 22, 2020 12:44
@@ -113,7 +113,7 @@
helps['keyvault create'] = """
type: command
short-summary: Create a key vault.
long-summary: Default permissions are created for the current user or service principal unless the `--no-self-perms` flag is specified.
long-summary: If `--enable-rbac-authorization` is not specified, then default permissions are created for the current user or service principal unless the `--no-self-perms` flag is specified.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement is cumbersome.

Suggested change
long-summary: If `--enable-rbac-authorization` is not specified, then default permissions are created for the current user or service principal unless the `--no-self-perms` flag is specified.
long-summary: Default permissions are created for the current user or service principal unless the `--no-self-perms` or `--enable-rbac-authorization` flag is specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants