You can deploy infra and dashboard using GitHub action, but first you need to setup credentials and secrets. Using Cloud Shell or Azure CLI, login to Azure, set the Azure context and execute the following commands to generate the required credentials:
Azure CLI:
# Replace {service-principal-name} and {subscription-id} with your
# Azure subscription id and any name for your service principal.
az ad sp create-for-rbac \
--name "{service-principal-name}" \
--role "Contributor" \
--scopes "/subscriptions/{subscription-id}" \
--sdk-auth
This will generate the following JSON output ( You need this info for next step):
{
"clientId": "<GUID>",
"clientSecret": "<GUID>",
"subscriptionId": "<GUID>",
"tenantId": "<GUID>",
(...)
}
Add the JSON output as a repository secret with the name AZURE_CREDENTIALS
in your GitHub repository:
To do so, execute the following steps:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click on the Settings tab.
- In the left sidebar, click Secrets.
- Click New repository secret.
- Type the name
AZURE_CREDENTIALS
for your secret in the Name input box. - Enter the JSON output from above as value for your secret.
- Click Add secret.
In order to deploy the Infrastructure as Code (IaC) templates to the desired Azure subscription, you will need to modify some parameters in the forked repository. Therefore, this step should not be skipped for neither Azure DevOps/GitHub options. There are two files that require updates:
.github/workflows/infra-deploy.yml
andinfra/params.dev.json
.
Update these files in a separate branch and then merge via Pull Request to trigger the initial deployment.
In this file you need to update the environment variables section. Just click on .github/workflows/infra-deploy.yml and edit the following section:
env:
AZURE_SUBSCRIPTION_ID: "7c1d967f-37f1-4047-bef7-05af9aa80fe2" # Update to your subscription id
AZURE_LOCATION: "southeastasia" # Update to location you want to deploy to
The following table explains each of the parameters:
Parameter | Description | Sample value |
---|---|---|
AZURE_SUBSCRIPTION_ID | Specifies the subscription ID of the Data Landing Zone where all the resources will be deployed | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
AZURE_LOCATION | Specifies the region where you want the resources to be deployed. Please check Supported Regions | southeastasia |
In this file you need to update the variable values. Just click on infra/params.dev.json and edit the values. An explanation of the values is given in the table below:
Parameter | Description | Sample value |
---|---|---|
location | Specifies the location for all resources. | southeastasia |
environment | Specifies the environment of the deployment. | dev , tst or prd |
prefix | Specifies the prefix for all resources created in this deployment. | ssatt |
primaryRegion | Specifies the primary region for Cosmos DB. | northeurope |
secondaryRegion | Specifies the secondary region for Cosmos DB. | westeurope |
maxThroughput | Specifies the max throughput you want to limit database to. | 4000 |
partitionKey | Specifies the partition key to be used for Gremlin database. | accountId |
databaseName | Specifies name for cosmos database. | database01 |
graphName | Specifies name for Gremlin collection. | graph01 |
clientIp | Specifies the address space of the public subnet that is used for accessing Synapse workspace. (Change this ..!) | 0.0.0.0 |
sqlAdminPassword | Default password to use. (Change this ..! ) | **ChangeMeNow1234!** |
Enable workflow actions by navigating to Actions tab.
After following the instructions and updating the parameters and variables in your repository in a separate branch and opening the pull request, you can merge the pull request back into the main
branch of your repository by clicking on Merge pull request. By doing this, you trigger the deployment workflow.
Congratulations! You have successfully executed all steps to deploy the template into your environment through GitHub Actions.
Now, you can navigate to the Actions tab of the main page of the repository, where you will see a workflow with the name Deploy infra
running. Click on it to see how it deploys the environment.