Lab 6: Deploy a local function project to an Azure Functions app
Task 1: Deploy using the Azure Functions Core Tools
- On the taskbar, select the Windows Terminal icon.
Run the following command to change the current directory to the $HOME\training-az204\Labs\02\Starter\func directory:
cd $HOME\training-az204\Labs\02\Starter\funcFrom command prompt, run the following command to login to the Azure Command-Line Interface (CLI):
az loginIn the Microsoft Edge browser window, enter the name and password of the Microsoft or Azure Active Directory account you are using in this lab, and then select Sign in.
- Return to the currently open Windows Terminal window. Wait for the sign-in process to finish.
From the command prompt, run the following command to publish the function app project (replace the
<function-app-name>placeholder with the name of the function app you created earlier in this lab):func azure functionapp publish <function-app-name>Note: For example, if your Function App name is funclogicstudent, your command would be
func azure functionapp publish funclogicstudent. You can review the documentation to [publish the local function app project][azure-functions-core-tools-publish-azure] using the Azure Functions Core Tools.Wait for the deployment to finalize before you move forward with the lab.
- Close the currently running Windows Terminal application.
Task 2: Validate deployment
- On the taskbar, select the Microsoft Edge icon, and select the tab that displays the Azure portal (https://portal.azure.com).
- On the Azure portal's navigation pane, select the Resource groups link.
- On the Resource groups blade, select the Serverless resource group that you created previously in this lab.
- On the Serverless blade, select the funclogic[yourname] function app that you created previously in this lab.
- On the Function App blade, select the Functions option in the Functions section.
- On the Functions pane, select the existing GetSettingInfo function.
- In the Function blade, select the Code + Test option in the Developer section.
- In the function editor, select Test/Run.
- In the automatically displayed pane, in the HTTP method drop-down list, select GET.
- Select Run to test the function.
In the HTTP response content, review the results of the test run. The JSON content should now include the following code:
{ "version": "0.2.4", "root": "/usr/libexec/mews_principal/", "device": { "id": "21e46d2b2b926cba031a23c6919" }, "notifications": { "email": "joseph.price@contoso.com", "phone": "(425) 555-0162 x4151" } }
Review
In this exercise, you deployed a local function project to Azure Functions and validated that the functions work in Azure.