From 5b8311bf40425b81a4335eed346d0ad849e3b1cf Mon Sep 17 00:00:00 2001 From: Sebastian Szvetecz Date: Mon, 30 Sep 2024 15:03:07 +0200 Subject: [PATCH 1/3] Adapted codebreaker-azure.yml Github Action - Set DOTNET_ENVIRONMENT=Staging for all container apps in codebreakertest --- .github/workflows/codebreaker-azure.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codebreaker-azure.yml b/.github/workflows/codebreaker-azure.yml index 532c7db..2e30500 100644 --- a/.github/workflows/codebreaker-azure.yml +++ b/.github/workflows/codebreaker-azure.yml @@ -72,23 +72,28 @@ jobs: with: AZURE_ENV_NAME: codebreakertest - set-blazor-staging-environmentvariable: + # Set the environment variable DOTNET_ENVIRONMENT to "Staging" for all container apps in the containerapp environment + set-staging-environmentvariables: runs-on: ubuntu-latest needs: [deploy-test] steps: - name: Azure Login uses: azure/login@v2 with: - creds: ${{ secrets.AZURE_CREDENTIALS_TESTENV }} - - name: Update DOTNET_ENVIRONMENT for the Blazor containerapp to Staging + creds: ${{ secrets.AZURE_CREDENTIALS }} + - name: Update DOTNET_ENVIRONMENT for all container apps to Staging uses: azure/cli@v2 with: azcliversion: latest - inlineScript: az containerapp update -n blazor -g rg-codebreakertest --set-env-vars DOTNET_ENVIRONMENT=Staging + # Stores the container app ids in a variable + # Updates the DOTNET_ENVIRONMENT environment variable to Staging for all container apps in the containerapp environment + inlineScript: | + containerAppIds=$(az containerapp list -g rg-codebreakertest --query "[].id | join(' ', @[])" | tr -d '"') + az containerapp update --set-env-vars DOTNET_ENVIRONMENT=Staging --ids $containerAppIds --query [].id deploy-prod: uses: ./.github/workflows/deploy.yml secrets: inherit needs: [deploy-test] with: - AZURE_ENV_NAME: codebreakerprod + AZURE_ENV_NAME: codebreakerprod \ No newline at end of file From 6f6113e42e7bc03a10e81db632c55aba0c4cd445 Mon Sep 17 00:00:00 2001 From: Sebastian Szvetecz Date: Mon, 30 Sep 2024 15:07:20 +0200 Subject: [PATCH 2/3] Adapted configurations for the user service --- .../CodeBreaker.UserService/appsettings.Development.json | 8 +------- .../CodeBreaker.UserService/appsettings.Production.json | 9 +++++++++ .../CodeBreaker.UserService/appsettings.Staging.json | 9 +++++++++ .../user/CodeBreaker.UserService/appsettings.json | 7 ------- 4 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 src/services/user/CodeBreaker.UserService/appsettings.Production.json create mode 100644 src/services/user/CodeBreaker.UserService/appsettings.Staging.json diff --git a/src/services/user/CodeBreaker.UserService/appsettings.Development.json b/src/services/user/CodeBreaker.UserService/appsettings.Development.json index aae3116..5690151 100644 --- a/src/services/user/CodeBreaker.UserService/appsettings.Development.json +++ b/src/services/user/CodeBreaker.UserService/appsettings.Development.json @@ -1,13 +1,7 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, "AzureActiveDirectory": { // codebreakertest directory - "ClientId": "66fc7e33-fa9f-4929-b3e1-ae8806fd87da", + "ClientId": "706ef61f-8253-4cd1-bd6e-f811c5766566", "TenantId": "366bd2be-85a4-48dd-b3ab-5d37e5d5d972", "GamerNameAttributeKey": "extension_69ecacfaed14473ba27f9937b5195afb_GamerName" // The appId of the extension attribute can be found in the Azure Portal unter App Registrations -> All Applications -> "b2c-extensions-app. Do not modify. Used by AADB2C for storing user data." -> Application (client) ID // ClientSecret not here, because it's a secret diff --git a/src/services/user/CodeBreaker.UserService/appsettings.Production.json b/src/services/user/CodeBreaker.UserService/appsettings.Production.json new file mode 100644 index 0000000..73ea762 --- /dev/null +++ b/src/services/user/CodeBreaker.UserService/appsettings.Production.json @@ -0,0 +1,9 @@ +{ + "AzureActiveDirectory": { + // codebreaker3000 directory + "ClientId": "20cc57dd-80ed-4a55-a629-d01a33de26f2", + "TenantId": "6a4e85c9-8636-4a94-a31b-894074bd6f9b", + "GamerNameAttributeKey": "extension_dd21590c971e431494da34e2a8d47cce_GamerName" // The appId of the extension attribute can be found in the Azure Portal unter App Registrations -> All Applications -> "b2c-extensions-app. Do not modify. Used by AADB2C for storing user data." -> Application (client) ID + // ClientSecret not here, because it's a secret + } +} diff --git a/src/services/user/CodeBreaker.UserService/appsettings.Staging.json b/src/services/user/CodeBreaker.UserService/appsettings.Staging.json new file mode 100644 index 0000000..5690151 --- /dev/null +++ b/src/services/user/CodeBreaker.UserService/appsettings.Staging.json @@ -0,0 +1,9 @@ +{ + "AzureActiveDirectory": { + // codebreakertest directory + "ClientId": "706ef61f-8253-4cd1-bd6e-f811c5766566", + "TenantId": "366bd2be-85a4-48dd-b3ab-5d37e5d5d972", + "GamerNameAttributeKey": "extension_69ecacfaed14473ba27f9937b5195afb_GamerName" // The appId of the extension attribute can be found in the Azure Portal unter App Registrations -> All Applications -> "b2c-extensions-app. Do not modify. Used by AADB2C for storing user data." -> Application (client) ID + // ClientSecret not here, because it's a secret + } +} diff --git a/src/services/user/CodeBreaker.UserService/appsettings.json b/src/services/user/CodeBreaker.UserService/appsettings.json index a30a6e0..95d8097 100644 --- a/src/services/user/CodeBreaker.UserService/appsettings.json +++ b/src/services/user/CodeBreaker.UserService/appsettings.json @@ -6,13 +6,6 @@ } }, "AllowedHosts": "*", - "AzureActiveDirectory": { - // codebreaker3000 directory - "ClientId": "20cc57dd-80ed-4a55-a629-d01a33de26f2", - "TenantId": "6a4e85c9-8636-4a94-a31b-894074bd6f9b", - "GamerNameAttributeKey": "extension_dd21590c971e431494da34e2a8d47cce_GamerName" // The appId of the extension attribute can be found in the Azure Portal unter App Registrations -> All Applications -> "b2c-extensions-app. Do not modify. Used by AADB2C for storing user data." -> Application (client) ID - // ClientSecret not here, because it's a secret - }, "UserGroupAssignments": { "5db8a353-7c02-4c3b-afa2-f60364d20210": [ "admin" ] }, From 37818365b0cf6bb7ede63df6871c590903539f92 Mon Sep 17 00:00:00 2001 From: Sebastian Szvetecz Date: Mon, 30 Sep 2024 15:11:22 +0200 Subject: [PATCH 3/3] Correceted secret name in github action --- .github/workflows/codebreaker-azure.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codebreaker-azure.yml b/.github/workflows/codebreaker-azure.yml index 2e30500..d8a35fd 100644 --- a/.github/workflows/codebreaker-azure.yml +++ b/.github/workflows/codebreaker-azure.yml @@ -80,7 +80,7 @@ jobs: - name: Azure Login uses: azure/login@v2 with: - creds: ${{ secrets.AZURE_CREDENTIALS }} + creds: ${{ secrets.AZURE_CREDENTIALS_TESTENV }} - name: Update DOTNET_ENVIRONMENT for all container apps to Staging uses: azure/cli@v2 with: