Skip to content

Commit 5ef14a2

Browse files
committed
Switc to using an RBAC SP to deploy to a dev environment
1 parent 4c681ea commit 5ef14a2

6 files changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/PocketDDDServerWebAPI2024.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212

1313
jobs:
1414
build:
15-
runs-on: windows-latest
15+
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Setup .NET SDK
@@ -34,9 +34,14 @@ jobs:
3434
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
3535

3636
deploy:
37-
runs-on: windows-latest
37+
runs-on: ubuntu-latest
38+
environment: dev
3839
needs: build
3940
steps:
41+
- name: Log in with Azure
42+
uses: azure/login@v1
43+
with:
44+
creds: '${{ secrets.AZURE_CREDENTIALS }}'
4045
- name: Download artifact from build job
4146
uses: actions/download-artifact@v3
4247
with:
@@ -45,6 +50,5 @@ jobs:
4550
- name: Deploy to Azure WebApp
4651
uses: azure/webapps-deploy@v2
4752
with:
48-
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
49-
publish-profile: ${{ secrets.PocketDDDServerWebAPI2024_3A54 }}
53+
app-name: pocketddd-dev-api-server
5054
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

terraform/database.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ resource "azurerm_mssql_database" "sqldb" {
2121

2222
# prevent the possibility of accidental data loss
2323
lifecycle {
24-
prevent_destroy = true
24+
prevent_destroy = false
2525
}
2626
}

terraform/image.png

28.5 KB
Loading

terraform/keyvault.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ resource "azurerm_key_vault" "key_vault" {
2222
secret_permissions = [
2323
"Get",
2424
"Set",
25-
"List"
25+
"List",
26+
"Delete"
2627
]
2728

2829
storage_permissions = [

terraform/outputs.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "api_server_url" {
2+
value = azurerm_linux_web_app.api_server_web_app.default_hostname
3+
}

terraform/readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Command to create a new deployment service principal
2+
```
3+
az ad sp create-for-rbac -n DevDeployment --role Contributor --scopes /subscriptions/<insert-subscription-id>
4+
```
5+
Add the JSON output as a secret named `AZURE_CREDENTIALS` to GitHub. I've added this as a secret specific to an environment
6+
![alt text](image.png)

0 commit comments

Comments
 (0)