Skip to content

[AZINTS-4139] Specify max client secret TTL when creating app registration#67

Merged
gpalmz merged 4 commits into
mainfrom
gpalmz/azure-client-secret-ttl
Oct 31, 2025
Merged

[AZINTS-4139] Specify max client secret TTL when creating app registration#67
gpalmz merged 4 commits into
mainfrom
gpalmz/azure-client-secret-ttl

Conversation

@gpalmz
Copy link
Copy Markdown
Collaborator

@gpalmz gpalmz commented Oct 31, 2025

Expiring secrets are a huge pain for everyone. Let's default this to the max TTL of 2 years rather than the default of 1 year. If the customer cares enough to want a shorter secret TTL, they can create a new secret and update it in the UI after creation.

Note: it is possible to set policies to reduce the max TTL of client secrets. We should determine the behavior of this command (with and without specifying --years) when such policies are in place and follow-on to handle this error, most likely by retrying without specifying --years.

EDIT: I just went ahead and did a generic except/retry without the --years param.

@gpalmz gpalmz requested a review from benjjs October 31, 2025 01:16
@gpalmz gpalmz requested a review from a team as a code owner October 31, 2025 01:16
# Try setting the TTL to the max of 2 years.
result = execute_json(cmd.param("--years", f"{APP_REGISTRATION_CLIENT_SECRET_TTL_YEARS}"))
# If it fails, just use the default TTL.
except Exception:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could just be except no?

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.

Linters tend to complain about that, also that excepts BaseException which includes weird stuff like StopIteration (iterator exit signal) etc

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Huh weird

Copy link
Copy Markdown
Collaborator

@benjjs benjjs left a comment

Choose a reason for hiding this comment

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

otherwise looks good

@gpalmz gpalmz merged commit db4400d into main Oct 31, 2025
2 checks passed
@gpalmz gpalmz deleted the gpalmz/azure-client-secret-ttl branch October 31, 2025 15:04
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