diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 054c509..b49ec96 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -9,9 +9,6 @@ on: resourceGroupName: required: true type: string - reviewApiUrl: - required: true - type: string secrets: AZURE_CLIENT_ID: required: true @@ -19,8 +16,6 @@ on: required: true AZURE_SUBSCRIPTION_ID: required: true - reviewApiKey: - required: true jobs: validate: diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 63db677..4af2f69 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -32,12 +32,10 @@ jobs: with: environment: test resourceGroupName: TodoAppTest - reviewApiUrl: https://sandbox.contoso.com/reviews secrets: AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - reviewApiKey: ${{ secrets.REVIEW_API_KEY_TEST }} needs: [build, lint] deploy-production: @@ -46,10 +44,8 @@ jobs: with: environment: production resourceGroupName: TodoAppProd - reviewApiUrl: https://api.contoso.com/reviews secrets: AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - reviewApiKey: ${{ secrets.REVIEW_API_KEY_PRODUCTION }} needs: [deploy-test] diff --git a/infra/main.bicep b/infra/main.bicep index 8145fbf..24208e5 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -81,6 +81,10 @@ resource appServiceApp 'Microsoft.Web/sites@2022-03-01' = { name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' value: applicationInsights.properties.ConnectionString } + { + name: 'AzureAd__ClientSecret' + value: '@Microsoft.KeyVault(SecretUri=https://todo-app-rbqkyp2g5zxmq.vault.azure.net/secrets/ClientSecret/)' + } ] } } diff --git a/src/TodoApp/Controllers/WeatherForecastController.cs b/src/TodoApp/Controllers/WeatherForecastController.cs index c72242e..569b408 100644 --- a/src/TodoApp/Controllers/WeatherForecastController.cs +++ b/src/TodoApp/Controllers/WeatherForecastController.cs @@ -30,7 +30,7 @@ public WeatherForecastController(ILogger logger, [HttpGet(Name = "GetWeatherForecast")] public async Task> Get() { - // var user = await _graphServiceClient.Me.GetAsync(); + var user = await _graphServiceClient.Me.GetAsync(); _logger.LogInformation("Getting weather forecast"); diff --git a/src/TodoApp/Properties/launchSettings.json b/src/TodoApp/Properties/launchSettings.json index 38c73a7..eeabd2d 100644 --- a/src/TodoApp/Properties/launchSettings.json +++ b/src/TodoApp/Properties/launchSettings.json @@ -28,4 +28,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/TodoApp/appsettings.Development.json b/src/TodoApp/appsettings.Development.json index ff66ba6..5e9fd7f 100644 --- a/src/TodoApp/appsettings.Development.json +++ b/src/TodoApp/appsettings.Development.json @@ -5,4 +5,4 @@ "Microsoft.AspNetCore": "Warning" } } -} +} \ No newline at end of file diff --git a/src/TodoApp/appsettings.json b/src/TodoApp/appsettings.json index 74a840f..b6a0ec9 100644 --- a/src/TodoApp/appsettings.json +++ b/src/TodoApp/appsettings.json @@ -4,6 +4,7 @@ "Domain": "qualified.domain.name", "TenantId": "1d063515-6cad-4195-9486-ea65df456faa", "ClientId": "cf2b7db1-87aa-4fe1-90c8-219abd6f1609", + "ClientSecret": "secret-from-app-registration", "Scopes": "user_impersonation", "CallbackPath": "/signin-oidc" },