Thanks for reaching out and for reporting you’re experiencing this issue.
Fortunately, we’re aware of this one and you can view more about the progress we’ve made by checking out the GitHub Issue.
This bug in particular has been fixed in 2022.1.184+.
It only appears to show up when creating a new API key via the Users page, if you follow the steps below from the GitHub Issue to create a key via your profile, it should allow you to change the expiry date:
1. Click into your profile (upper right)
2. Click API Keys
3. Click New API Key
4. Type in a name
5. Change the duration to one of the predefined durations
6. Click Generate new
I hope this helps! Please reach out if you have any further questions or concerns, or if you’re not able to generate an API key using this alternative method.
I believe that since the error is rooted in the UI of creating an API key particularly via the Users page, I would expect the underlying API call to still function as expected.
I haven’t explicitly tested this out but as the REST API is used when generating API keys from the Profile page, I don’t think PowerShell scripts will be impacted.