Skip to content

aaz commands for managing user assigned identities#729

Merged
kairu-ms merged 2 commits intoAzure:mainfrom
kimorris27:feature-kimorris27/user-assigned-identities-aaz-commands
Apr 18, 2025
Merged

aaz commands for managing user assigned identities#729
kairu-ms merged 2 commits intoAzure:mainfrom
kimorris27:feature-kimorris27/user-assigned-identities-aaz-commands

Conversation

@kimorris27
Copy link
Contributor

What

AAZ commands for CRUD operations on user assigned identities generated from the 2024-11-30 stable MSI RP API spec

Why

I'm an ARO SRE from Red Hat. The az aro CLI is soon going to include functionality that will create and delete user assigned identities on behalf of the user as they create and delete Azure Red Hat OpenShift managed identity clusters.

My understanding is that we are supposed to use aaz commands rather than importing the azure-sdk-for-python, so I generated these and thought it made sense to get them merged here before incorporating them into our CLI.

You can see the beginning of my work here: https://github.com/Azure/ARO-RP/tree/kimorris27/ARO-6443-miwi-cli-phase-2

Testing

In my local development environment, I've already been able to successfully delete managed identities as part of an az aro delete using the code in the branch I linked to above, which validates that the generated code works as expected on a basic level.

Additional Context

The aaz-dev-tools code generator initially gave an error as I was trying to generate the aaz CLI code, and I found that I needed to tweak the MSI RP's API spec to get it to work: https://github.com/kimorris27/azure-rest-api-specs/tree/kimorris27/tweak-msi-spec-for-aaz-code-generation

Do those changes need to be merged?

@kimorris27 kimorris27 force-pushed the feature-kimorris27/user-assigned-identities-aaz-commands branch from 633fa33 to 35c9d18 Compare April 17, 2025 16:14
@kairu-ms kairu-ms merged commit 477924f into Azure:main Apr 18, 2025
2 checks passed
kimorris27 added a commit to Azure/ARO-RP that referenced this pull request Apr 23, 2025
kimorris27 added a commit to Azure/ARO-RP that referenced this pull request Apr 23, 2025
kimorris27 added a commit to Azure/ARO-RP that referenced this pull request Apr 28, 2025
* Introduce aaz commands for creating and deleting managed identities

For reference: Azure/aaz#729

* Add `--delete-identities` parameter and static validation

* Fix minor typo in preexisting code

* Extend dynamic validation to include cluster deletion and add unit tests
for newly-introduced managed identity deletion permission validation

As I was working on extending the dynamic validation I felt like it
could use some refactoring for a few different reasons:

- It was awkward to extend it to deletion
- The logic is split in what was (to me) an unintuitive way between
  custom.py's `validate` function, and `_dynamic_validators.py`

Refactoring that is beyond the scope of this PR though, so I did my best
to extend what we have in a way that hopefully makes it easier to work
with whether we refactor all of this validation or not.

* Add automated identity deletion, including validation of the CLI user's permission to do so before proceeding

* Fix linter errors

* Add `is_preview` to the `--delete-identities` argument

* Add unit tests for `--delete-identities` static validator
kevinobriendotca pushed a commit to Azure/ARO-RP that referenced this pull request Apr 30, 2025
* Introduce aaz commands for creating and deleting managed identities

For reference: Azure/aaz#729

* Add `--delete-identities` parameter and static validation

* Fix minor typo in preexisting code

* Extend dynamic validation to include cluster deletion and add unit tests
for newly-introduced managed identity deletion permission validation

As I was working on extending the dynamic validation I felt like it
could use some refactoring for a few different reasons:

- It was awkward to extend it to deletion
- The logic is split in what was (to me) an unintuitive way between
  custom.py's `validate` function, and `_dynamic_validators.py`

Refactoring that is beyond the scope of this PR though, so I did my best
to extend what we have in a way that hopefully makes it easier to work
with whether we refactor all of this validation or not.

* Add automated identity deletion, including validation of the CLI user's permission to do so before proceeding

* Fix linter errors

* Add `is_preview` to the `--delete-identities` argument

* Add unit tests for `--delete-identities` static validator
kevinobriendotca pushed a commit to Azure/ARO-RP that referenced this pull request May 1, 2025
* Introduce aaz commands for creating and deleting managed identities

For reference: Azure/aaz#729

* Add `--delete-identities` parameter and static validation

* Fix minor typo in preexisting code

* Extend dynamic validation to include cluster deletion and add unit tests
for newly-introduced managed identity deletion permission validation

As I was working on extending the dynamic validation I felt like it
could use some refactoring for a few different reasons:

- It was awkward to extend it to deletion
- The logic is split in what was (to me) an unintuitive way between
  custom.py's `validate` function, and `_dynamic_validators.py`

Refactoring that is beyond the scope of this PR though, so I did my best
to extend what we have in a way that hopefully makes it easier to work
with whether we refactor all of this validation or not.

* Add automated identity deletion, including validation of the CLI user's permission to do so before proceeding

* Fix linter errors

* Add `is_preview` to the `--delete-identities` argument

* Add unit tests for `--delete-identities` static validator
@kimorris27 kimorris27 deleted the feature-kimorris27/user-assigned-identities-aaz-commands branch May 23, 2025 17:46
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.

2 participants