3

Azure have a new(ish) static hosting product which would be very useful. The idea is you can check your static site code into Git, and have it deploy to your site. You can even view branches as a sort of preview workflow.

The problem is Azure Static Web service only seems to work with Github.

Our organisation has all its repos in Azure DevOps, which is a seamless unified environment for our repos, build pipelines, and Azure web services. All our Devs are setup with Azure Dev ops git accounts, they dont have (non private) github accounts.

We dont want to have to go out and setup a duplicate git hosting outside of Azure - along with the pain of security, authorization, or linking with Active directory.

We want to use Azure Git with Azure Static web.

To a large extent, git is git.

Does anyone have any workarounds, hacks or tutorials to make these two Microsoft Azure products talk to each other?

John Little
  • 10,707
  • 19
  • 86
  • 158

3 Answers3

5

Azure Static Website now supports Azure DevOps Git Repo and continuous deployment from Azure DevOps pipeline. Please follow the bellow steps:

Step 1: In the create resource page use Other as deployment source enter image description here

Step 2: Once the resource is created, get the deployment token enter image description here

Once you commit your code in Azure DevOps Git repo

Step 3: Create a starter pipeline and use the below code snippet (use the deployment token grabbed above)

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
  - checkout: self
    submodules: true
  - task: AzureStaticWebApp@0
    inputs:
      app_location: '/WebSite'
      api_location: '/api'
      output_location: 'dist/WebSite'
    env:
      azure_static_web_apps_api_token: $(deployment_token)

The above code snippet is for the following Azure DevOps git repo structure enter image description here

I have written a step by step guide to do the same. Please refer if you need further information.

subhankars
  • 351
  • 2
  • 8
1

The ETA for Azure DevOps support is February. What you'll be able to do is:

  • Create a Static Web App without linking it to GitHub
  • Add an Azure Pipelines YAML to your repo with the task (we'll provide an example YAML that you can copy/paste). The task looks a lot like the GitHub Action in terms of input and capabilities. You'll need to set a pipeline variable for the deployment token (retrieved from the portal).
  • No support for PRs/environments yet. We don't have the same hooks as GitHub to act on PR open/close. We'll continue to investigate.

Please refer to this ticket. If you have any questions or suggestions, please also share it in the ticket.

Walter
  • 2,640
  • 1
  • 5
  • 11
0

Azure Devops support with Azure static web apps is announced and available in public preview.

You can read the documentation to publish an App with Azure Devops.

Also i published a video and a blog to publish an angular application, you can refer the same.

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396