Setting Up SonarQube in Azure with Azure AD Integration
Installing SonarQube
Go to the marketplace and install SonarQube from Bitnami – https://bitnami.com/stack/sonarqube/cloud/azure with the following:
- resize to D1_v2
- if desired, configure any NSG restrictions
After creation, set a DNS name label for the IP address.
Access using the domain name, and follow the directions in the link above to log in.
Setting up Azure AD Integration
Setting up HTTPS
To be able to use Azure AD, you have to use HTTPS.
Set up the Server base URL to be the configured HTTPS address in Administration → Configuration → General → Server base URL:
SSH into the server and set up a Let’s Encrypt script and enforce redirection to HTTPS here (make sure you aren’t behind a firewall to allow for Let’s Encrypt).
- https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/
- https://docs.bitnami.com/bch/apps/wordpress/administration/force-https-apache/
Restart Apache:
Verify that trying to access the HTTP version of SonarQube automatically redirects you to the HTTPS version.
Creating App Registration in Azure
Run the following command in CLI to generate a service principal:
You should receive some output data, which you will use when filling out info in SonarQube:
Set the Reply URL of the application to https:///oauth2/callback/aad:
Set the required permissions:
- Sign in and read user profile
- Read all users’ basic profiles
Installing Plug-in
Install the Azure Active Directory (AAD) Authentication Plug-in for SonarQube (restarting when requested):
Configure in Administration → General Settings → Azure Active Directory:
- Activate Azure AD
- Use the value in “appId”
- Use the value in “password”
- Use the value in “tenant”
- Allow users to sign-up.
Log out as admin, and verify the ability to log in as an Azure AD user.