Skip to content

Commit 635c830

Browse files
DEVOPS-95 updated the readme properly
1 parent 2298667 commit 635c830

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

README.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,62 @@
11
# azure-create-app-registrations-using-terraform
22
Create app registrations in Azure using terraform and github workflow
33

4+
# How code works
45

5-
#References
6+
* This repo uses terraform to create app registration and service principal in Azure.
7+
8+
# parameters used
9+
10+
| input name | description | type | mandatory |
11+
|------------|------------|-----|-------------|
12+
| app_registration_name | Azure App registration name | string | :heavy_check_mark: |
13+
| app_registration_owner | App registration owners names | string | :heavy_check_mark: |
14+
| app_registration_description | App registration description | string | |
15+
16+
# Terraform commands and How to run the code locally
17+
18+
1. Clone the repo and switch to the folder
19+
2. cd azure-create-app-registrations-using-terraform
20+
3. Then run `terraform init`
21+
4. run `terraform validate`
22+
5. then `terraform plan`
23+
6. provide the values when popped up
24+
7. then `terraform apply` and provide `yes` as confirmation
25+
26+
## Conditions
27+
28+
* Azure active directory user should have a proper mail id available
29+
30+
# How to run as a github workflow
31+
32+
1. Go to your cloned repo and then to actions tab
33+
34+
2. Choose the workflow `azure-create-app-registrations-using-terraform.yaml` on left side
635

7-
[azuread_application_password](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/application_password)
36+
3. Next click on `Run Workflow` on right side top and enter the input parameters required
37+
38+
4. Click on `Run Workflow` (green one)
39+
40+
5. After the job is completed, The app registration and sp will be created with owners
41+
42+
# Credentials needed
43+
44+
**Authentication to Azure is done using service principal**
45+
46+
```
47+
env:
48+
ARM_CLIENT_ID: ${{ secrets.APP_ID }}
49+
ARM_CLIENT_SECRET: ${{ secrets.APP_SECRET }}
50+
ARM_TENANT_ID: ${{ secrets.TENANT_ID }}
51+
ARM_SUBSCRIPTION_ID: ${{ secrets.SUBSCRIPTION_ID }}
52+
```
53+
54+
`ARM_CLIENT_ID`, `ARM_CLIENT_SECRET`, `ARM_TENANT_ID`, `ARM_SUBSCRIPTION_ID` are required Environment variables.
55+
56+
I used GitHub secrets on the workflow for authentication.
57+
58+
59+
#References
60+
* [using-secrets-in-github-actions](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions)
61+
* [azuread_application_password](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/application_password)
62+
* [azuread_service_principal](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/service_principal)

variable.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ variable "app_registration_owners" {
1111

1212
variable "app_registration_description" {
1313
type = string
14+
description = "Description for you app"
1415
default = "Azure App registration created using terraform"
1516
}

0 commit comments

Comments
 (0)