Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function configureSSOApplication() {
// Check to see if Azure CLI is installed. If it isn't installed then install it
const cliInstalled = await azureCliInstalled();
if(!cliInstalled) {
console.log("Azure CLI is not installed. Installing now before proceeding");
await installAzureCli();
console.log('Please close your command shell, reopen and run configure-sso again. This is neccessary to register the path to the Azure CLI');
return;
}
const userJson = await logIntoAzure();
if (userJson) {
console.log('Login was successful!');
const manifestInfo = await manifest.readManifestFile(defaults.manifestPath);
const applicationJson = await createNewApplication(manifestInfo.displayName);
ssoAppData.writeApplicationData(applicationJson.appId);
const secretJson = await setApplicationSecret(applicationJson);
ssoAppData.addSecretToCredentialStore(manifestInfo.displayName, secretJson.secretText);
updateProjectManifest(applicationJson.appId);
await logoutAzure();
console.log("Outputting Azure application info:\n");
console.log(applicationJson);
}
else {
throw new Error(`Login to Azure did not succeed.`);
}
}