Search code examples
azureazure-devopsazure-functionsazure-bicepazure-appservice

Deploying to App Service or Function using Bicep


curious, is it possible to deploy to azure app service or azure function app using bicep. That is, when creating app service in the bicep, we add the deployment of the app or function in the same template.

I have seen the sourcecontrol resources (see below) but it looks like it only support external git (github). my code is in azuredevops.

Microsoft.Web/sites/sourcecontrols@2021-01-01.

Background: Every time I run a bicep template all the function apps are redeployed and we lose all the functions they have already been deployed. I want to make sure that when the bicep is run, it redeploy the function app with the functions by pull them from the SCM.

Every time I run a bicep template all the function apps are redeployed and I lose all the functions they have already been deployed. I want to make sure that when the bicep is run, it redeploy the function app with the functions by pull them from the SCM.


Solution

  • Background: Every time I run a bicep template all the function apps are redeployed, and we lose all the functions they have already been deployed.

    If you want to avoid redeploying all the function apps every time you run the Bicep template, you can consider using Conditional deployments in Bicep with the if expression.

    With conditional deployments, you can specify a condition that determines whether to create a new function app or use an existing one.