Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apim-cli failure with ChangePasswordAtFirstLogin option in API Manager #394

Closed
anis-azzabi opened this issue May 30, 2023 · 5 comments
Closed
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@anis-azzabi
Copy link

APIM-CLI version

1.13.7

API-Management version

7.7.20223011

Bug description

When the option ChangePasswordOnFirstLogin is enabled (True) , it's not possible to use apim-cli.
After a fresh installation of API Manager through a CI/CD Pipeline my customer whould be able to use the apim-cli to import artefacts. Unfortunately, when we got the issue below :

image

Checking in APIManager logs, I see the operation POST /login failed.

image

Steps to reproduce

  • Option ChangePasswordFirstLogin in API Manager enabled
  • Do not change the password of the user which will be used in apim cli operations
  • Try any of apim cli operation

Relevant log output

No response

@anis-azzabi anis-azzabi added the bug Something isn't working label May 30, 2023
@rathnapandi
Copy link
Member

Hi @anis-azzabi,
APIM CLI uses API manager REST API to do all operations. For your case, we need to login to API manager UI first, change password and use it in CLI.

Am I missing anything here? Please do let me know.

@rathnapandi rathnapandi self-assigned this May 31, 2023
@anis-azzabi
Copy link
Author

Hi @rathnapandi
That's the point the login through the UI is mandatory in that case but the customer would have an end to end devops process without connecting through the UI when he setup a new environment.
The workaround that I found is changing the settings of api manager by using the API Manager REST API (https://apimanager:8075/api/portal/v1.3/config)
Could be this an enhancement for APIM CLI (settings get/import method). So the the settings get/import will not use the /login endpoint in the process but will call the API Rest API using the authorization basic header ?
I'll also check with the support if it could be enhancement in API Manager to be able to activate/deactivate this option when installing api manager.
Thanks for your feedback.

@anis-azzabi anis-azzabi reopened this Jun 7, 2023
@rathnapandi rathnapandi added the enhancement New feature or request label Jul 7, 2023
@rathnapandi
Copy link
Member

Hi @anis-azzabi,

I will fix this as part of the next release.

@rathnapandi
Copy link
Member

Hi @anis-azzabi,

Can you run the following commands? The first one will change the password, the second one will change flag ChangePasswordFirstLogin

step 1.

./apim.sh user changepassword -s api-env -n "*Name of user*" -loginName "*loginNameOfUser*" -newpassword "aNewPassword"
or
./apim.sh user changepassword -s api-env -id f6106454-1651-430e-8a2f-e3514afad8ee -newpassword "aNewPassword"

step 2:
./apim.sh settings import -c config.json -s api-env

@rathnapandi
Copy link
Member

@anis-azzabi, please reopen if it does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants