Skip to content

AvansICT/ICT1.3-2D-Graphics-Secure-Communication-SecureBackend-CodeSnippets

Repository files navigation

ICT1.3 - 2D Graphics & Secure Communication - Secure Backend - Code Snippets

This repository contains publicly available code snippets & scripts.

Aure ARM script - Create a free Azure App Service & Azure SQL database in a single deployment 🐱‍🏍

You can deploy this script directly using the Azure Portal:

  1. Navigate to: Deploy a custom template
  2. Load file or 'Build your own' and copy paste
  3. Create (or choose) Resource Group
  4. Provide the required parameters:
    • Student Number 👈 Will be used to prefix the resource names
    • SQL Administrator Credentials
    • The Home IP address you would like to allow to access the resources (you can add more in the portal)
  5. Press Create

After the deployment has succeeded, navigate to output parameters and save these values. You need them later when you setup the GitHub Workflow.

** Notes **

  • The free SQL Server database is not available in westeurope, so the script defaults to northeurope.
  • The SQL Server uses SQL Authentication only, as setting up Entra ID authentication through ARM templates is not straightforward.

GitHub Workflow Simplified

This scripts takes the outputs from the Azure ARM template and the project name and uses it to create a simple CI/CD workflow through GitHub actions.

  1. Add this script in the Git repository under /.github/workflows
  2. Enter the ARM outputs as repository secrets in Github

The following secrets are required to run this worflow

  • AZURE_WEBAPP_NAME 👉 The name of the web application in Azure (output from the ARM template)
  • AZURE_WEBAPP_PUBLISH_PASSWORD 👉 The publishing user password (output from the ARM template)
  • AZURE_WEBAPP_PUBLISH_USERNAME 👉 The publishing user name (output from the ARM template)
  • WEBAPI_PROJECT_NAME 👉 The name of the project needed to publish

The secrets are used to construct a publishing profile. Unfortunately it is not possible to extract the full publish profile through the ARM template.

** Notes **

  • It checks if the secrets are available, if not, cancels the flow
  • It defaults to DOTNET_CORE_VERSION: 9.0.x but this is tested with .NET 8 projects as well

Create additional SQL user

Execute this script on the Azure SQL Database to create a contained SQL database user with only read/write access.

About

Publicly provided code snippets for the module ICT1.3 2D Graphics Secure Communication

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published