Bicep to configure github action for app service source

Joey Liu 1 Reputation point Microsoft Employee
2022-01-24T22:57:39.867+00:00

Looking to utilize bicep to create a deployment pipeline to deploy application to Azure app service.
According to this doc: https://learn.microsoft.com/en-us/azure/templates/microsoft.web/sites/sourcecontrols?tabs=bicep#githubactioncodeconfiguration. Seems like we can use e.g. GitHub as the source control and also configure GitHub action to do the deployment. This will be extremely useful for custom deployment(anything other than node.js/python app).

However, I cannot find any relevant documentation/example on how to do that. Can we configure the GitHub action in bicep or we still need to define the workflow in our GitHub repo?

For example, I want to deploy a spring boot app to Azure app service. So in the GitHub action, I would normally do a Gradle build and similar stuff. Now, with bicep, Can I configure all this within bicep or I still need to define the build in GitHub

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,865 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 25,661 Reputation points Microsoft Employee
    2022-01-26T19:55:49.947+00:00

    Hi @Joey Liu ,

    However, I cannot find any relevant documentation/example on how to do that. Can we configure the GitHub action in bicep or we still need to define the workflow in our GitHub repo?

    https://learn.microsoft.com/en-us/azure/app-service/provision-resource-bicep has a template that demonstrates Microsoft.Web/sites/sourcecontrols. You can use the following bicep in your GitHub action.

       param webAppName string = uniqueString(resourceGroup().id) // Generate unique String for web app name  
       param sku string = 'F1' // The SKU of App Service Plan  
       param linuxFxVersion string = 'NODE|14-lts' // The runtime stack of web app  
       param location string = resourceGroup().location // Location for all resources  
       param repositoryUrl string = 'https://github.com/Azure-Samples/nodejs-docs-hello-world'  
       param branch string = 'master'  
       var appServicePlanName = toLower('AppServicePlan-${webAppName}')  
       var webSiteName = toLower('wapp-${webAppName}')  
       resource appServicePlan 'Microsoft.Web/serverfarms@2020-06-01' = {  
         name: appServicePlanName  
         location: location  
         properties: {  
           reserved: true  
         }  
         sku: {  
           name: sku  
         }  
       resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {  
         name: hostingPlanName  
         location: location  
         sku: {  
           name: skuName  
         }  
         properties:{  
           reserved: true  
         }  
       }  
       }  
       resource appService 'Microsoft.Web/sites@2020-06-01' = {  
         name: webSiteName  
         location: location  
         properties: {  
           serverFarmId: appServicePlan.id  
           siteConfig: {  
             linuxFxVersion: linuxFxVersion  
           }  
         }  
       }  
       resource srcControls 'Microsoft.Web/sites/sourcecontrols@2021-01-01' = {  
         name: '${appService.name}/web'  
         properties: {  
           repoUrl: repositoryUrl  
           branch: branch  
           isManualIntegration: true  
         }  
       }  
    

    For example, I want to deploy a spring boot app to Azure app service. So in the GitHub action, I would normally do a Gradle build and similar stuff. Now, with bicep, Can I configure all this within bicep or I still need to define the build in GitHub

    Bicep is for deploying resources to Azure, another tool for ARM deployments. Anything related to the build of resources will still need to be done in your GitHub action. Where those artifacts are deployed to can be handled by your bicep file.

    0 comments No comments