Skip to content

Commit

Permalink
"Updated GitHub workflow YAML file to remove unnecessary lines and co…
Browse files Browse the repository at this point in the history
…rrected syntax; added instructions to README.md on how to run the workflow" DEVOPS-70
  • Loading branch information
githubofkrishnadhas committed Jun 25, 2024
1 parent 27396da commit 29da67f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/add_owner_to_app_registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ jobs:

- name: Terraform show
run: terraform show "plan.out"

- name: Terraform Apply
run: |
ls -la
terraform apply --auto-approve "plan.out"
- name: Owners added for App registration
run:
echo "App registration owners - ${{ inputs.app_registration_owners }}"
# Add more steps for applying the Terraform plan
run: echo "App registration owners - ${{ github.event.inputs.app_registration_owners }}"

- name: Process Completed
run: echo "Completed...."
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,35 @@ add owners to azure app registrations from github workflow
* We wont be able to add same owner multiple times
* Azure active directory user shuld have a proper mail id available

# How to run as a github workflow

1. Go to your cloned repo and then to actions tab

![alt text](workflow.png)
2. Choose the workflow `add_owner_to_app_registration.yaml` on left side

3. Next click on `Run Workflow` and enter the input parameters required

![alt text](github_workflow_inputs.jpeg)

4. Click on `Run Workflow`

5. After the job is completedd, The owners will be added to app registration

# Credentials needed

**authentication to azure is done using service principal**

```
env:
ARM_CLIENT_ID: ${{ secrets.OWNER_SP_APP_ID }}
ARM_CLIENT_SECRET: ${{ secrets.OWNER_SP_APP_SECRET }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
```

`ARM_CLIENT_ID`, `ARM_CLIENT_SECRET`, `ARM_TENANT_ID`, `ARM_SUBSCRIPTION_ID` are required Environment variables.

I used Github secrets on the workflow for authentication.

#### Refer [configuring-the-service-principal-in-terraform](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret#configuring-the-service-principal-in-terraform)
Binary file added github_workflow_inputs.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 29da67f

Please sign in to comment.