0

Azure Static Web Apps are fantastic for hosting simple html pages, such as your "down" pages you point Azure traffic manager to when you want to do some site maintenance on your main site.

The problem with Azure static web apps is you cant upload your certificate to them, and if you use the free one, after exactly 6 months, the certificate will try to renew and fail, because DNS is pointing the custom domain to your main site. Next time you want to flip traffic manager to your down pages, you will get an SSL error.

The beauty of Azure static web apps is you can just point it to a github or Azure git repo, and it will create a pipeline which deploys your static site down page whenever it gets edit. All done with a few clicks, brilliant.

To solve this SSL issue we are trying to setup Azure App Service, but are having problems.

There is no Azure app service for static web pages, so we chose PHP as that is the closest.

When you create the Azure web app, it allows you to link your devops git repo (see screen shot), but unlike static web apps, does not create a pipeline or setup any auto deployment. Unfortunately, it doesn't create a yaml file in your repo like Azure Static Web apps does.

enter image description here

In fact, we can't find any way to deploy to the azure web app from git. The only option seems to be via Azure CLI, which certainly isn't an option for our web designers, and we haven't managed to get it working on apple silicon. There must be a CD option.

Any ideas?

When we solve this, the next problem will be setting up a custom domain and converting our certs we got from sectigo into the format required for Azure, and installing them.

2
  • What kind of repo are you using? Take a look at Azure Devops, that allows you to create a pipeline to deploy to azure web app, the same goes for Github Actions. They are many examples how to create a yaml pipeline to deploy to an azure app service.learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/… Commented Oct 9, 2023 at 21:32
  • Yes, we are using azure devops git and we have github. however, we cant find the magic needed to glue devops to azure web apps for a static website. If it was java or net the azure generates the pipeline yaml files for you, but not for static sites. The link you provide is great, but it does builds which we dont have, and deployment works on packages, which we dont have. Commented Oct 10, 2023 at 7:52

1 Answer 1

0

Well, it looks like Microsoft flagship Web App Service doesnt support its flagship Devops Git. It only works with github, which is a shame as our organisation has all its repos in devops git, and we dont even have a github account.

So the solution was to disconnect devops git as the source repo, and instead connect a github repo. Then the magic happens - azure commits a pre-created yaml workflow file and within a minute, a pipeline has deployed the single index.html page.

Looking at the yaml file, its overkill as to deploy a static set of files simply requires zip and unzip, but its installing php and running compose:

name: Build and deploy PHP app to Azure Web App - downsite-webapp-test on: push: branches: - main workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.2' - name: Check if composer.json exists id: check_files uses: andstor/file-existence-action@v1 with: files: 'composer.json' - name: Run composer install if composer.json exists if: steps.check_files.outputs.files_exists == 'true' run: composer validate --no-check-publish && composer install --prefer-dist --no-progress - name: Upload artifact for deployment job uses: actions/upload-artifact@v2 with: name: php-app path: . deploy: runs-on: ubuntu-latest needs: build environment: name: 'Production' url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} steps: - name: Download artifact from build job uses: actions/download-artifact@v2 with: name: php-app - name: 'Deploy to Azure Web App' uses: azure/webapps-deploy@v2 id: deploy-to-webapp with: app-name: 'downsite-webapp-test' slot-name: 'Production' publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_0114941A0CAD430486665B90DE3ED3A2 }} package: . 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.