You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related command az ad app credential reset az ad sp create-for-rbac
Is your feature request related to a problem? Please describe.
Currently, --years is added directly to the current year to compute the credential end date:
If there is a policy in the tenant that forbids expiry time longer than 365 days, the 366 day expiry time will cause commands to fail.
Luckily, now is already past 2024-02-29, so the next time it will happen is 2028.
Describe the solution you'd like
Use datetime.timedelta instead of dateutil.relativedelta.relativedelta to add exactly 365 days per year, regardless of leap years, in order to make the computed end date definitive.
Related command
az ad app credential resetaz ad sp create-for-rbacIs your feature request related to a problem? Please describe.
Currently,
--yearsis added directly to the current year to compute the credential end date:azure-cli/src/azure-cli/azure/cli/command_modules/role/custom.py
Lines 1176 to 1177 in 03ad904
If the time range contains a leap year, 366 days will be added.
Caution
If there is a policy in the tenant that forbids expiry time longer than 365 days, the 366 day expiry time will cause commands to fail.
Luckily, now is already past 2024-02-29, so the next time it will happen is 2028.
Describe the solution you'd like
Use
datetime.timedeltainstead ofdateutil.relativedelta.relativedeltato add exactly 365 days per year, regardless of leap years, in order to make the computed end date definitive.Azure Portal uses exactly 365 days: