[AD] Fix #28520: az ad app credential reset/az ad sp create-for-rbac: Each year specified by --years now only contains 365 days#28541
Open
[AD] Fix #28520: az ad app credential reset/az ad sp create-for-rbac: Each year specified by --years now only contains 365 days#28541
az ad app credential reset/az ad sp create-for-rbac: Each year specified by --years now only contains 365 days#28541Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Collaborator
|
fix AD bug |
jiasli
commented
Mar 11, 2024
|
|
||
| app_start_date = datetime.datetime.now(datetime.timezone.utc) | ||
| app_end_date = app_start_date + relativedelta(years=years or 1) | ||
| app_end_date = app_start_date + datetime.timedelta(days=_years_to_days(years)) |
Member
Author
There was a problem hiding this comment.
There is no need to use years or 1 as the fallback logic already happens at L1162:
jiasli
commented
Mar 11, 2024
|
|
||
| if not end_date: | ||
| end_date = start_date + relativedelta(years=1) - relativedelta(hours=24) | ||
| end_date = start_date + datetime.timedelta(days=_years_to_days(1)) |
Member
Author
There was a problem hiding this comment.
The removal of - relativedelta(hours=24) is to address #13769 (comment)
jiasli
commented
Mar 11, 2024
| import uuid | ||
|
|
||
| import dateutil.parser | ||
| from dateutil.relativedelta import relativedelta |
Member
Author
There was a problem hiding this comment.
Although dateutil.relativedelta.relativedelta also supports days, dateutil is third-party:
https://docs.python.org/3/library/datetime.html
Package dateutil
Third-party library with expanded time zone and parsing support.
Third-party library dependencies should be as less as possible.
az ad app credential reset/az ad sp create-for-rbac: Each year specified by --years now only contains 365 daysaz ad app credential reset/az ad sp create-for-rbac: Each year specified by --years now only contains 365 days
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #28520
Related command
az ad app credential resetaz ad sp create-for-rbacDescription
Each year specified by
--yearsnow only contains 365 days. Leap years are not considered.Testing Guide