Skip to content

Commit

Permalink
Add SPN. Create Azure Resource Group (#4)
Browse files Browse the repository at this point in the history
* Add SPN
* Create Azure Resource Group
  • Loading branch information
ondfisk authored Aug 24, 2024
1 parent 2b58787 commit 7bff61c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:

jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
configuration: Release
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/infrastructure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Infrastructure

on:
push:
branches:
- main
paths:
- .github/workflows/infrastructure.yml
- infrastructure/**
pull_request:
branches:
- main
paths:
- .github/workflows/infrastructure.yml
- infrastructure/**

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

test:
name: Test
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
permissions:
id-token: write
environment: Staging

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Create Resource Group
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az group create --name ${{ vars.RESOURCE_GROUP }} --location ${{ vars.LOCATION }}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"cSpell.enableFiletypes": [
"*"
],
"cSpell.words": [],
"cSpell.words": [
"azcliversion"
],
"editor.trimAutoWhitespace": true,
"files.autoSave": "afterDelay",
"files.trimFinalNewlines": true,
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This project demonstrates a number of capabilities in Azure DevOps and Microsoft

## Prerequisites

1. Create a *Microsoft Entra application (SPN)* and connect it to *GitHub* cf. <https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure-openid-connect>.
1. Create SQL admin group:

```bash
Expand All @@ -28,7 +29,7 @@ This project demonstrates a number of capabilities in Azure DevOps and Microsoft
az ad group member add --group "$GROUP" --member-id $ME
```

1. Add the *Azure Service Connection* to the group.
1. Add the *SPN* to the group.
1. Update [`/infrastructure/main.bicepparam`](/infrastructure/main.bicepparam).
1. Deploy the *infrastructure* pipeline
1. Connect web app to SQL database,
Expand All @@ -39,7 +40,7 @@ This project demonstrates a number of capabilities in Azure DevOps and Microsoft
- When running the commands, answer `n` to the question *"Do you want to set current user as Entra admin? (y/n)"*

```bash
RESOURCE_GROUP=MyWebApp
RESOURCE_GROUP=MyWebApp2
SQL_SERVER=sql-968b52419901
WEBAPP=web-968b52419901
DATABASE=Movies
Expand Down

0 comments on commit 7bff61c

Please sign in to comment.