Make updates to Azure Functions code by pushing to a git repository. Use the code created in the previous exercise and modify it and deploy the changes with a git push.
Solution – Step 1: Set Up Git Credentials to Use With Azure Functions Code
- Log in to portal.azure.com and open the panel for your Functions app
- Set up a username and password for accessing the Functions code using the “Deployment credentials” section of “Platform features”
- Choose the “Deployment options” panel and set up a local git connector
- Now choose the “Properties” panel and find the “GIT URL”
- User the Git URL to clone the repository locally with
git clone URL-just-created
- That created a local copy of the Functions App folder structure
Solution – Step 2: Link a Git Push to Updating the Azure Function
- First let’s try a simple change followed by a push to Azure. I’m going to change the “sleepsuntil” function that I had before to return “9999” regardless of input and push that to Azure
…then git push…
Testing this change in the browser has no luck:
- …and then I went down a rabbit hole of trying to figure out why the push didn’t update the function until…
HAVE YOU TRIED TURING IT OFF AND ON AGAIN?
…the fix was to disconnect the local git option in the Azure portal…
…and then connect again. It all worked fine after that!