Azure Function App is an application service that acts as the host construct for functions. Businesses can group functions together to make it easier to manage, deploy, and share resources.
Why Function App?
This exciting service, the Azure cloud, is a serverless one that allows you to write and maintain less code and save money. Instead of worrying about maintaining and deploying servers, the cloud infrastructure provides all the servers necessary to keep your applications running.
Let’s dive into Azure Function Creation.
Use your credentials to log in to Azure
Search for Function App
To create a new app, click the “Add” button
Fill in the details for Subscription, Resource group name and Function app name
Select Code in the Publish field, and then select Runtime Stack, Version, Region as shown below. Click Review and Create
Wait for your function app to validate. Once validation is complete, click on the “Create” button to initiate your deployment. Go to your function app. You can find configuration settings on the left-hand side of the main page. Click the Save button and go to Identity.
The number of managed identities assigned by a system is limited to one per resource. They are tied to the resource’s lifecycle. Azure role-based access control (Azure RBAC) allows you to grant permissions to the managed identities. Azure AD authenticates the managed identity, so there is no need to store any credentials in codes.
Click on Azure role assignments, select the subscription (if there are many), and then click the “save” button.
Go to the main page. Click on the function blade to the left. Select functions -> Add -> Create environment as Develop in portal. Scroll down to enter the function name.
Authorization level controls whether a function requires an API key. Function uses a function keyboard; Admin uses your master keys. When you select your function, the function and master keys will be displayed in the portal’s ‘keys management panel’. Go to Function App Settings for user-based authentication.
Click on Add to initiate the deployment of your function.
Click on Code + Test Blade to replace the code with the one below and save it.
param block is used to pass in input bindings for namespace System.Net. param($Request; $TriggerMetadata); # Write to the Azure Functions log stream. Write-Host “PowerShell HTTP trigger functions processed a request.” # Interact with the query parameters or the request body. $RgName = $Request.Query.RgName if (-not $RgName) $RgName = $Request.Body.RgName $VmName = $Request.Query.VmName if (-not $VmName) $VmName = $Request.Body.VmName $sid=Get-Content -Path D:\home\site\wwwroot\file.txt $body = “This HTTP triggered function executed successfully. For a personalized response, enter a name in either the query string or the request body. if ($VmName -and $RgName) Select-Object Name,ResourceGroupName,Location,@Name=”Image”; Expression=$_.StorageProfile.ImageReference.Offer,@Name=”Zones”; Expression=$_.Zones,@Name=”VmSize”; Expression=$_.HardwareProfile.VmSize,@Name=”AvailabilitySetReference”; Expression=$_.AvailabilitySetReference.Id,@Name=”ImageSku”; Expression=$_.StorageProfile.ImageReference.Sku,@Name=”OsDiskType”; Expression=$_.StorageProfile.OsDisk.ManagedDisk.StorageAccountType $body = $VmDetails # Associate values to output bindings by calling ‘Push-OutputBinding’. Name Response -Va