Azure Function App ps1 script automated deployment - azure

i have deployed azure function app through ARM template but sadly can't figure out how to include
function and put a code into it without logging to portal. Preferably included in arm or deployment script ( powershell ). I saw that there are options for VS code but we try to avoid that.
Best regards

Related

How to schedule deploying an ARM template?

I have an ARM template which I can run as a custom deployment in the Azure portal. How do I get this to run automatically on a schedule? I'm guessing I can do it with an automation account, but I did not find anything in there about deploying ARM templates.
You have two (2) options:
Logic App
Runbook Automation
There is a post that shows how to implement this using either solutions.

Add a PowerShell script to Azure Marketplace Offer

I would like to publish an Azure Managed Application to the Azure Marketplace. Is it possible to add to the "app.zip" an own PowerShell Script, which executes some additional deployment steps besides the Azure Resource Manager Template?
The Script would invoke the arm template and handle some outputs of the Template
The way to think about these is that you can only do tasks that can be done in a template. Today, there's no way to run an arbitrary script in an ARM template.
That help?
After some research and contacting the MS Support I found two possible solutions:
Using a VM with a Custom Script Extension. Downside: VM needs long to startup and is expensive if we do not delete it afterwards.
Using a Azure Container Instance to run the script. Starts up in about 45 seconds and doesn't cost anything if we don't use it. -> Tutorial

How to deploy Logic App code via Azure DevOps?

I'm currently trying to understand how I can deploy a Logic App from Azure DevOps. I'm trying to give my team the ability to back out changes. Is this possible without using a series of scripts?
I'd like to create a release that does the following
Deploy Logic App ARM template
Upload code to Logic App from VSTS/DevOps
There is a good article on how to prepare the logic apps for CI/CD into multiple environments using ARM template.
You just need to download the ARM template for the Logic app and make changes in the template file, declaring parameters. You will also need to create parameter files for each environment. You can then create a Azure Pipelines and upload the files to the build and release definition.
https://platform.deloitte.com.au/articles/preparing-azure-logic-apps-for-cicd
You should extract the ARM template for your logic app and upload it to DevOps, then make a build and release definition
there are several helpful links available, here is one:
https://platform.deloitte.com.au/articles/preparing-azure-logic-apps-for-cicd
Edit: Link to Logic App Extractor:
If you just want to know how to deploy Logic App with VSTS, maybe this doc could help you.

Azure Devops - How to run a powershell script on an App Service post-deploy?

I'm struggling to understand how to run a powershell script (it just runs an exe) on the App Service after deployment using Azure Devops.
FYI - the exe just reads some config info in the web.config and does some database updates. So it needs access to the transformed web.config and the SQL Server database that the App Service has.
I've tried adding a Powershell step using a Release Pipeline deployment task, but it seems to only run on the Agent, which does not have the context that the exe needs.
I can run the script manually using the Kudu command line window tool, but I need to automate this thing.
I've seen a few SO articles like this: How to add a custom post deployment script to azure websites? or Kudu post-deployment commands not running but I think that only works when you use the inbuilt deployment mechanism for App Services. ie - I couldn't get it to trigger the script in post-deploy from Azure Devops.
This is in the comments above, but if people find it useful, the answer to this is
Using the Azure App Service Deploy task, expand Post Deployment Action, there's an option to run a script (or inline write one).
This will be executed as part of the app service deployment and should allow you to do what you want. It's run at the wwwroot folder so the files need to be present in your actual deployment (zip/folder).

How to deploy Azure Function app including code using ARM template from Azure marketplace

I want to deploy a Function App including code using an ARM template that is going to be published in the Azure Marketplace as a Managed App.
I've seen in the docs that you can add a sourcecontrols element in the ARM template that you can use to point to e.g. a GitHub repository. However, I don't want to use a repository, I want to code to be uploaded to the Function App.
I also know you can upload the code using the Azure CLI or powershell, however this will not be possible when publishing the app in the marketplace.
Is there a way to have a package that contains everything including the code and have that uploaded to the Function App all using an ARM template in the Azure Marketplace?
You should take a look at Run-From-Zip. Basically, you host the zip package somewhere (typically storage blob), and in ARM template you just set a WEBSITE_RUN_FROM_ZIP App Setting pointing to it.
As an alternative, you could use the ARM msdeploy extension, and point it to the zip package (e.g. something like this).

Resources