How to manage different auth profiles per environments in a REST api project
Hello everybody,
i have the task to create tests in a Scrum team, which should then run in different environments (Dev, Release, Master). The speciality is, that I have to test REST services in the Azure Cloud. It is common to use a Key Vault in the Cloud, which contains the Secrets/Tokens for the different services. To access the Key Vault, it is necessary to make an OAuth 2.0 authentication. For each environment there is a Key Vault and accordingly different credentials for authentication.
The tests runs in a CD pipelines and the environment is passed as a parameter. How can I tell ReadyAPI to use a specific authentication profile for each environment?
Unfortunately, it is not possible in Azure to specify the password for "Managed Identities". The password is generated automatically, so this option is not available.
In this forum there is a solution (https://community.smartbear.com/t5/SoapUI-Pro/How-to-manage-different-auth-profiles-per-environments-for/td-p/112428) that works with project properties. For a basic authentication I would accept this solution. Since the authentication is done via "OAuth 2.0 Azure" I would like to find a solution where the "Auth-Manager" of ReadyAPI is used. Does anyone have an idea?
Thanks in advance
Hi New2API ,
I have now found a way to select the Auth-Profile depending on the environment. Here is my solution.
// prefix from profile name def ENV ENV = testRunner.testCase.testSuite.project.activeEnvironment.name log.info "test environment is >>$ENV<<..." // profile name suffix def profileSuffix = "OAuth2Azure" def authEntry = context.getCurrentStep().testCase.testSuite.project.getAuthRepository().getEntry(ENV + profileSuffix); log.info authEntry.name
Thanks for your help.