Skip to content

e2e test with rbac authorization instead of access policies on keyvault#4755

Merged
cadenmarchese merged 7 commits intomasterfrom
yithian/ARO-25803
Apr 17, 2026
Merged

e2e test with rbac authorization instead of access policies on keyvault#4755
cadenmarchese merged 7 commits intomasterfrom
yithian/ARO-25803

Conversation

@yithian
Copy link
Copy Markdown
Collaborator

@yithian yithian commented Apr 7, 2026

Which issue this PR addresses:

For ARO-25803

What this PR does / why we need it:

This PR switches the e2e keyvault to be created with rbac instead of access policies. This keeps us aligned with Azure documentation and ensures that what we're telling customers to do actually works

Test plan for issue:

Run e2e

Is there any documentation that needs to be updated for this PR?

No, this keeps us aligned with what the documentation currently says

How do you know this will function as expected in production?

Checking the e2e results and the e2e cluster keyvault to see if it was created with rbac

@yithian yithian force-pushed the yithian/ARO-25803 branch from 7b224d4 to ca66976 Compare April 8, 2026 13:26
@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 8, 2026

/azp run ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 8, 2026

/azp run ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 9, 2026

/azp run ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

bizz001
bizz001 previously requested changes Apr 9, 2026
Copy link
Copy Markdown
Collaborator

@bizz001 bizz001 left a comment

Choose a reason for hiding this comment

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

This switches the vault to Key Vault RBAC, but I only see the DES permissions being granted via access policy. Since access policies no longer authorize data-plane access once RBAC is enabled, shouldn’t this PR also add the corresponding Key Vault RBAC grant for the DES identity?
Docs:
https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-guide
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/disks-enable-customer-managed-keys-cli

@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 10, 2026

This switches the vault to Key Vault RBAC, but I only see the DES permissions being granted via access policy. Since access policies no longer authorize data-plane access once RBAC is enabled, shouldn’t this PR also add the corresponding Key Vault RBAC grant for the DES identity? Docs: https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-guide https://learn.microsoft.com/en-us/azure/virtual-machines/linux/disks-enable-customer-managed-keys-cli

@bizz001 Wait, is this a single keyvault for the whole e2e environment (that all clusters share)? Or is it one keyvault-per-cluster?

If it's a single keyvault, I'll need to figure out a way to test this change (and thus, our existing documentation) without breaking things for everyone else

func (g *generator) diskEncryptionKeyVaultRBAC() *arm.Resource {
// use the Azure built-in Key Vault Crypto Service Encryption User role
// See: https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-guide?tabs=azure-cli#azure-built-in-roles-for-key-vault-data-plane-operations
return rbac.ResourceRoleAssignment("e147488a-f6f5-4113-8e2d-b22465e65bf6", tenantIDHack, "Microsoft.KeyVault", "parameters['kvName']")
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Please closely review this line! The listed ID is the Key Vault Crypto Service Encryption User built in Azure role, which I think matches the former access policy. However, I'm not sure if the tenant ID is correct here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Tenant ID is incorrect here, I think. I would expect this role assignment to be granted over the SystemAssigned Managed Identity of the keyvault resource itself (similar to what the deleted KV Access Policy resource used for the ObjectID field).

@yithian yithian force-pushed the yithian/ARO-25803 branch from 00f464b to 3772d13 Compare April 13, 2026 21:06
Because `rbac.ResourceRoleAssignment` already puts square brackets around the object ID for you
Copy link
Copy Markdown
Contributor

@kimorris27 kimorris27 left a comment

Choose a reason for hiding this comment

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

Noting that you were gone for the day and you were hoping your last commit would have CI green tomorrow morning, I decided to push a commit myself that I think will fix it :D

@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 14, 2026

/azp run ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@yithian yithian force-pushed the yithian/ARO-25803 branch 4 times, most recently from 7f5043f to d1bd819 Compare April 14, 2026 21:21
@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 15, 2026

/azp run ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@yithian yithian force-pushed the yithian/ARO-25803 branch from d1bd819 to 8c1508d Compare April 15, 2026 15:51
@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 15, 2026

/azp run ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 16, 2026

/azp run ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 16, 2026

/azp run ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@yithian
Copy link
Copy Markdown
Collaborator Author

yithian commented Apr 16, 2026

/azp run ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Member

@cadenmarchese cadenmarchese left a comment

Choose a reason for hiding this comment

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

Access policies are cleaned up along with the keyvault, but a role assignment is left behind until it's explicitly deleted. Can we ensure that we clean up this role assignment when we destroy the e2e cluster?

@kimorris27
Copy link
Copy Markdown
Contributor

Access policies are cleaned up along with the keyvault, but a role assignment is left behind until it's explicitly deleted. Can we ensure that we clean up this role assignment when we destroy the e2e cluster?

The code should be fine as-is. This is a per-E2E run key vault, and since the role assignment is done at the scope of the key vault resource, the role assignment gets deleted when the key vault gets deleted.

A role assignment doesn't get deleted when its assignee is deleted, but it does get deleted when its scope is deleted.

@cadenmarchese
Copy link
Copy Markdown
Member

@kimorris27 thanks for the correction!

@cadenmarchese cadenmarchese dismissed bizz001’s stale review April 17, 2026 16:00

Comment requiring new role assignment was addressed and included in a later commit.

@cadenmarchese cadenmarchese merged commit a2a38d8 into master Apr 17, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chainsaw Pull requests or issues owned by Team Chainsaw

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants