diff --git a/.github/workflows/application.yml b/.github/workflows/application.yml index 5265736..6544e23 100644 --- a/.github/workflows/application.yml +++ b/.github/workflows/application.yml @@ -34,7 +34,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 9.0.100-preview.7.24407.12 + dotnet-version: 9.0.100-preview.6.24328.19 - name: .NET Restore run: dotnet restore @@ -49,7 +49,7 @@ jobs: run: dotnet publish src/MyApp/MyApp.csproj --no-build --configuration ${{ env.configuration }} --output app - name: Zip Artifact - run: zip -r app.zip app + run: pushd app && zip -r ../app.zip . && popd - name: Upload Artifact uses: actions/upload-artifact@v4 @@ -111,14 +111,12 @@ jobs: chmod +x ./efbundle # ./efbundle --connection "$CONNECTION_STRING" - - name: Deploy - id: deploy-to-webapp - uses: azure/webapps-deploy@v3 + - name: Deploy Web App + uses: azure/cli@v2 with: - resource-group-name: ${{ vars.RESOURCE_GROUP }} - app-name: ${{ vars.WEBAPP }} - slot-name: ${{ vars.DEPLOYMENT_SLOT }} - package: app.zip + azcliversion: latest + inlineScript: | + az webapp deploy --resource-group ${{ vars.RESOURCE_GROUP }} --name ${{ vars.WEBAPP }} --slot ${{ vars.DEPLOYMENT_SLOT }} --src-path app.zip --clean production: name: Deploy to Production diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3c9fa86..2b91f15 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,6 +35,7 @@ jobs: uses: super-linter/super-linter@v7 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VALIDATE_CSHARP: false # temporary workaround for linter not support .NET 9 VALIDATE_CSS: false VALIDATE_CSS_PRETTIER: false VALIDATE_JSCPD: false diff --git a/.vscode/settings.json b/.vscode/settings.json index 05ab0f6..6df580f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,6 +17,8 @@ "healthz", "MSSQL", "outfile", + "popd", + "pushd", "pwsh", "resourcegroup", "serverfarms", diff --git a/global.json b/global.json new file mode 100644 index 0000000..e2b6cfd --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "9.0.100-preview.6.24328.19", + "rollForward": "latestFeature" + } +} \ No newline at end of file diff --git a/infrastructure/main.bicep b/infrastructure/main.bicep index 1f5f1bf..e450e97 100644 --- a/infrastructure/main.bicep +++ b/infrastructure/main.bicep @@ -38,13 +38,15 @@ resource webApp 'Microsoft.Web/sites@2023-12-01' = { reserved: true hyperV: false siteConfig: { - linuxFxVersion: 'DOTNETCORE|8.0' + linuxFxVersion: 'DOTNETCORE|9.0' alwaysOn: true http20Enabled: true minTlsVersion: '1.2' scmMinTlsVersion: '1.2' ftpsState: 'Disabled' healthCheckPath: '/healthz' + httpLoggingEnabled: true + detailedErrorLoggingEnabled: true } httpsOnly: true publicNetworkAccess: 'Enabled' @@ -71,12 +73,30 @@ resource deploymentSlot 'Microsoft.Web/sites/slots@2023-12-01' = { scmMinTlsVersion: '1.2' ftpsState: 'Disabled' healthCheckPath: '/healthz' + httpLoggingEnabled: true + detailedErrorLoggingEnabled: true } httpsOnly: true publicNetworkAccess: 'Enabled' } } +resource webAppBasicPublishingCredentialsFtp 'Microsoft.Web/sites/basicPublishingCredentialsPolicies@2023-12-01' = { + name: 'ftp' + parent: webApp + properties: { + allow: false + } +} + +resource slotBasicPublishingCredentialsFtp 'Microsoft.Web/sites/slots/basicPublishingCredentialsPolicies@2023-12-01' = { + name: 'ftp' + parent: deploymentSlot + properties: { + allow: false + } +} + resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2023-09-01' = { name: logAnalyticsWorkspaceName location: location diff --git a/src/MyApp/Migrations/20240824184034_Initial.Designer.cs b/src/MyApp/Migrations/20240824184034_Initial.Designer.cs index 03c7e25..0d66e31 100644 --- a/src/MyApp/Migrations/20240824184034_Initial.Designer.cs +++ b/src/MyApp/Migrations/20240824184034_Initial.Designer.cs @@ -19,7 +19,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "9.0.0-preview.7.24405.3") + .HasAnnotation("ProductVersion", "9.0.0-preview.6.24327.4") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); diff --git a/src/MyApp/Migrations/AppDbContextModelSnapshot.cs b/src/MyApp/Migrations/AppDbContextModelSnapshot.cs index 368dc32..4a44d77 100644 --- a/src/MyApp/Migrations/AppDbContextModelSnapshot.cs +++ b/src/MyApp/Migrations/AppDbContextModelSnapshot.cs @@ -16,7 +16,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "9.0.0-preview.7.24405.3") + .HasAnnotation("ProductVersion", "9.0.0-preview.6.24327.4") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); diff --git a/src/MyApp/MyApp.csproj b/src/MyApp/MyApp.csproj index e828a2a..3b18129 100644 --- a/src/MyApp/MyApp.csproj +++ b/src/MyApp/MyApp.csproj @@ -8,12 +8,13 @@ + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/src/MyApp/Program.cs b/src/MyApp/Program.cs index fadc846..7877529 100644 --- a/src/MyApp/Program.cs +++ b/src/MyApp/Program.cs @@ -1,3 +1,4 @@ +using Azure.Monitor.OpenTelemetry.AspNetCore; using Microsoft.EntityFrameworkCore; using MyApp.Features; using MyApp.Features.Movies; @@ -6,6 +7,10 @@ var builder = WebApplication.CreateBuilder(args); // Add services to the container. +if (!builder.Environment.IsDevelopment()) +{ + builder.Services.AddOpenTelemetry().UseAzureMonitor(); +} builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); builder.Services.AddHealthChecks(); diff --git a/tests/MyApp.Tests/MyApp.Tests.csproj b/tests/MyApp.Tests/MyApp.Tests.csproj index 25e02e8..818978c 100644 --- a/tests/MyApp.Tests/MyApp.Tests.csproj +++ b/tests/MyApp.Tests/MyApp.Tests.csproj @@ -14,7 +14,7 @@ all - +