# 💎 Breakout: Integrate the sample application into Azure AD 💎
# Here is what you will learn 🎯
Deploy the sample application with Azure AD Integration.
In Challenge 3 we already created the needed Azure AD applications to integrate the SCM Contacts API into Azure AD. We acquired an access_token from Azure AD and made a request to the API. Now it's time to integrate all APIs of the sample application into Azure AD.
Here is the list of the remaining services we have to integrate into Azure AD:
- SCM Resource API
- SCM Search API
- SCM Visitreports API
- SCM Textanalytics
- SCM Frontend
TIP
📝 If you started this day based on the checkpoint, please follow this link to see an adopted guide.
As in Challenge 3 we always perform the following steps for each service:
- Create and checkout a new branch
- Edit the the existing build definition and change everything from
day4
today5
- Save the definition, commit the changes and push the branch to the remote repository
- Run the build targeting the feature branch
- Edit the Release definition, add the needed variables and adjust the deployment tasks
- Run the Release build
- Merge the feature branch into the master branch
We don't need to create additional Azure AD applications for the remaining services. All APIs uses the same Azure AD application that we already created in Challenge 3 for each stage (Development and Testing). The frontend service uses the client application.
TIP
📝 Be careful that you don't confuse the IDs of the stage Development
and Testing
.
# Table Of Contents
# SCM Frontend
# Basics
Name | Value |
---|---|
Feature branch | features/scmfrontendaad |
Build definition yaml | scm-frontend-ci.yaml |
Release definition | SCM-Frontend-CD |
# CD Build Variables - Stage Development
Name | Value |
---|---|
AadTenantId | the Id of your Azure Ad Tenant |
AadApiClientIdUri | http://scmapi-dev (opens new window) |
AadFrontendClientId | UI AppId, the value that you received from the output when you created the Azure AD application for stage Development |
# CD Build Variables - Stage Testing
Name | Value |
---|---|
AadTenantId | the Id of your Azure Ad Tenant |
AadApiClientIdUri | http://scmapi-test (opens new window) |
AadFrontendClientId | UI AppId, the value that you received from the output when you created the Azure AD application for stage Testing |
TIP
📝 As on Day 4 we have to configure the settings for the SCM Frontend. Adjust the Azure CLI task which applies the settings to dist/settings.js
as follows:
echo "var uisettings = { \"tenantId\": \"$(AadTenantId)\", \"audience\": \"$(AadApiClientIdUri)\", \"clientId\": \"$(AadFrontendClientId)\", \"enableStats\": true, \"endpoint\": \"$(ContactsEndpoint)\", \"resourcesEndpoint\": \"$(ResourcesEndpoint)\", \"searchEndpoint\": \"$(SearchEndpoint)\", \"reportsEndpoint\": \"$(ReportsEndpoint)\", \"aiKey\": \"`az resource show -g $(ResourceGroupName) -n $(ApplicationInsightsName) --resource-type "microsoft.insights/components" --query "properties.InstrumentationKey" -o tsv`\" };" > $(System.ArtifactsDirectory)/_SCM Frontend-CI/drop/dist/settings/settings.js
Please skip this step if you've started on the checkpoint, the correct variable replacement should already be in place.
Make sure that you copy the whole line!
# SCM Resource API
# Basics
Name | Value |
---|---|
Feature branch | features/scmresourcesaad |
Build definition yaml | scm-resources-ci.yaml |
Release definition | SCM-Resources-CD |
# CD Build Variables - Stage Development
Name | Value | ARM Template parameter | Stage |
---|---|---|---|
AadInstance | https://login.microsoftonline.com (opens new window) | aadInstance | Development |
AadClientId | API AppId, the value that you received from the output when you created the Azure AD application | aadClientId | Development |
AadTenantId | The id of your Azure AD Tenant | aadTenantId | Development |
AadDomain | The domain name of your Azure AD e.g. azuredevcollege.onmicrosoft.com | aadDomain | Development |
AadClientIdUri | http://scmapi-dev (opens new window) | aadClientIdUri | Development |
# CD Build Variables - Stage Testing
Name | Value | ARM Template parameter | Stage |
---|---|---|---|
AadInstance | https://login.microsoftonline.com (opens new window) | aadInstance | Testing |
AadClientId | API AppId, the value that you received from the output when you created the Azure AD application for stage Testing | aadClientId | Testing |
AadTenantId | The id of your Azure AD Tenant | aadTenantId | Testing |
AadDomain | The domain name of your Azure AD e.g. azuredevcollege.onmicrosoft.com | aadDomain | Testing |
AadClientIdUri | http://scmapi-test (opens new window) | aadClientIdUri | Testing |
# ARM Template Override Parameters
-webAppName $(ApiAppName) -sku $(AppServicePlanSKU) -use32bitworker $(Use32BitWorker) -alwaysOn $(AlwaysOn) -storageAccountName $(StorageAccountName) -functionAppName $(ResizerFunctionName) -applicationInsightsName $(ApplicationInsightsName) -serviceBusNamespaceName $(ServiceBusNamespaceName) -aadInstance $(AadInstance) -aadClientId $(AadClientId) -aadTenantId $(AadTenantId) -aadDomain $(AadDomain) -aadClientIdUri $(AadClientIdUri)
# SCM Search API
# Basics
Name | Value |
---|---|
Feature branch | features/scmsearchaad |
Build definition yaml | scm-search-ci.yaml |
Release definition | SCM-Search-CD |
# CD Build Variables - Stage Development
Name | Value | ARM Template parameter | Stage |
---|---|---|---|
AadInstance | https://login.microsoftonline.com (opens new window) | aadInstance | Development |
AadClientId | API AppId, the value that you received from the output when you created the Azure AD application | aadClientId | Development |
AadTenantId | The id of your Azure AD Tenant | aadTenantId | Development |
AadDomain | The domain name of your Azure AD e.g. azuredevcollege.onmicrosoft.com | aadDomain | Development |
AadClientIdUri | http://scmapi-dev (opens new window) | aadClientIdUri | Development |
# CD Build Variables - Stage Testing
Name | Value | ARM Template parameter | Stage |
---|---|---|---|
AadInstance | https://login.microsoftonline.com (opens new window) | aadInstance | Testing |
AadClientId | API AppId, the value that you received from the output when you created the Azure AD application for stage Testing | aadClientId | Testing |
AadTenantId | The id of your Azure AD Tenant | aadTenantId | Testing |
AadDomain | The domain name of your Azure AD e.g. azuredevcollege.onmicrosoft.com | aadDomain | Testing |
AadClientIdUri | http://scmapi-test (opens new window) | aadClientIdUri | Testing |
# ARM Template Override Parameters
-webAppName $(ApiAppName) -appPlanSKU $(AppServicePlanSKU) -use32bitworker $(Use32BitWorker) -alwaysOn $(AlwaysOn) -storageAccountName $(StorageAccountName) -functionAppName $(IndexerFunctionName) -applicationInsightsName $(ApplicationInsightsName) -serviceBusNamespaceName $(ServiceBusNamespaceName) -azureSearchServiceName $(AzureSearchServiceName) -azureSearchSKU $(AzureSearchSKU) -azureSearchReplicaCount $(AzureSearchReplicaCount) -azureSearchPartitionCount $(AzureSearchPartitionCount) -aadInstance $(AadInstance) -aadClientId $(AadClientId) -aadTenantId $(AadTenantId) -aadDomain $(AadDomain) -aadClientIdUri $(AadClientIdUri)
# SCM VisitReports API
# Basics
Name | Value |
---|---|
Feature branch | features/scmvisitreportsaad |
Build definition yaml | scm-visitreports-ci.yaml |
Release definition | SCM-VisitReports-CD |
# CD Build Variables - Stage Development
TIP
📝 You only need to adjust the deployment task that uses the ARM template scm-visitreport-nodejs-infra.json
Name | Value | ARM Template parameter | Stage |
---|---|---|---|
AadTenantId | The id of your Azure AD Tenant | aadTenantId | Development |
AadClientIdUri | http://scmapi-dev (opens new window) | aadClientIdUri | Development |
# CD Build Variables - Stage Testing
Name | Value | ARM Template parameter | Stage |
---|---|---|---|
AadTenantId | The id of your Azure AD Tenant | aadTenantId | Testing |
AadClientIdUri | http://scmapi-test (opens new window) | aadClientIdUri | Testing |
# ARM Template Override Parameters
This is relevant for the file scm-visitreport-nodejs-infra.json
:
-sku $(AppServicePlanSKU) -skuCode $(AppServicePlanSKUCode) -webAppName $(ApiAppName) -applicationInsightsName $(ApplicationInsightsName) -cosmosDbAccount $(CosmosDbAccount) -serviceBusNamespaceName $(ServiceBusNamespaceName) -commonResGroup $(ResourceGroupName) -aadTenantId $(AadTenantId) -aadClientIdUri $(AadClientIdUri)
# SCM Textanalytics
Feature branch: features/scmtextanalyticsaad
Build definition yaml: scm-textanalytics-ci.yaml
Release definition: SCM-TextAnalytics-CD
TIP
📝 As the service SCM TextAnalytics does not offer an accessible API there is no need to adjust the Release build. We only need to adjust the build definition, create a new build and deploy it to Azure.
# Wrap-Up
🎉 Congratulations 🎉
You've done it. There is nothing more to add, just test the application and enjoy your success 🥳