6

How to setup File system storage utilization alert rule for web apps

 3 years ago
source link: https://techcommunity.microsoft.com/t5/apps-on-azure/how-to-setup-file-system-storage-utilization-alert-rule-for-web/ba-p/2438420?WT_mc_id=DOP-MVP-4025064
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
How to setup File system storage utilization alert rule for web apps

How to setup File system storage utilization alert rule for web apps

Published 06-11-2021 04:29 AM 927 Views

As following document indicated, File System Usage is a new metric being rolled out globally, no data is expected unless your app is hosted in an App Service Environment.

https://docs.microsoft.com/en-us/Azure/app-service/web-sites-monitor#understand-metrics

Therefore you may not use this metric for alert rule currently, even you can see this metric in alert rule setting UI.



As a workaround, we can create a WebJob to call following rest api  that can get app service planFile System storage’ utilization and then sent an email if met exceed usage situation.

https://management.azure.com /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Web/serverfarms/{app service plan name}/usages?api-version=2019-08-01



Here is my demo steps for your reference.

1.In order to call resource manager rest api, firstly I created service principal that can access resources.Sign in to  Azure Account through the Azure portal->Select Azure Active Directory->Select App registrations->Select New registration.





To access resources in subscription, assign the application to a role as contributor role.





Select the particular subscription that include your app service plan to monitor.





Select Access control(IAM)->Add role assignment, add the contributor role to application.





Get values for signing in.Select Azure Active Directory->From App registrations in Azure AD, select your application.Copy the Directory(tenant)ID and  Application(client) ID and will use it later.





At this App registration, Create a new application secret, select Certificates & secrets->Select Client secrets -> New client secret.





Also copy this secret for later use.

For more details for above steps, please refer below link:

https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-porta...



2.Create a new C# .net Core Console app in the visual studio for the web job development.





Install the latest stable 3.x version of the Microsoft.Azure.WebJobs.Extensions NuGet package, which includes Microsoft.Azure.WebJobs.

Here's the Package Manager Console command for version 3.0.2:

Install-Package Microsoft.Azure.WebJobs.Extensions -version 3.0.2

Install the Active directory authentication package in Visual Studio.The package is available in the NuGet Gallery.





Get an access token for the app in C# program.In  program.cs, add an assembly reference for the ActiveDirectory identity model:



using Microsoft.IdentityModel.Clients.ActiveDirectory;

And add a method to get an access token using previously copied tenantId, applicationId and client secret.

private static async Task<string> GetAccessToken(string tenantid, string clientid, string clientsecret)
        {
            string authContextURL = "https://login.microsoftonline.com/" + tenantid;
            var authenticationContext = new AuthenticationContext(authContextURL);
            var credential = new ClientCredential(clientid, clientsecret);
            var result = await authenticationContext.AcquireTokenAsync("https://management.azure.com/", credential);

            if (result == null)
            {
                throw new InvalidOperationException("Failed to obtain the JWT token");
            }

           
           return result.AccessToken;
        }


Now everything is set to make REST calls defined in the Azure Resource manager REST API.We can add a method to call a following GET REST API for app service planFile System storage’ utilization  with the token gotten by above method and calculate if the current usage exceed limit.

https://management.azure.com/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Web/serverf...



private static bool GetUsage(string URI, String token)
        {
            Uri uri = new Uri(String.Format(URI));

            // Create the request
            var httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            httpWebRequest.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + token);
            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Method = "GET";

            // Get the response
            HttpWebResponse httpResponse = null;
            try
            {
                httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return false;
            }

            string result = null; 
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                result = streamReader.ReadToEnd();
            }
            Int64 currentvalue = Convert.ToInt64(JObject.Parse(result).SelectToken("value[10].currentValue").ToString());
            Int64 limit = Convert.ToInt64(JObject.Parse(result).SelectToken("value[10].limit").ToString());
            if (currentvalue > limit)//You can set your condition as your requirement
                return true;
            else
                return false;
}


Then in the execute method, will send email if the usage exceed. In this method I used SendGrid to implement emailing feature.

For more details regarding SendGrid configuration, please refer following link:https://docs.microsoft.com/en-us/azure/sendgrid-dotnet-how-to-send-email





public static void Execute()
        {
            string tenantId = "yourtenandid";
            string clientId = "yourclientid";
            string clientSecret = "yourclientsecret";
            string restapiurl = "https://management.azure.com/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Web/serverfarms/{appserviceplan}/usages?api-version=2019-08-01";

            var token = GetAccessToken(tenantId,clientId,clientSecret).Result;
            if (GetUsage(restapiurl, token))
            {
                var apiKey = ConfigurationManager.AppSettings["AzureWebJobsSendGridApiKey"].ToString();
                var client = new SendGridClient(apiKey);
                var msg = new SendGridMessage()
                {
                    From = new EmailAddress("[email protected]", "DX Team"),
                    Subject = "henry",
                };
                msg.AddTo(new EmailAddress("[email protected]", "Test User"));
                msg.AddContent("text/html", "<html><body>There is Alert for File sytem usage.</body></html>");
                var response = client.SendEmailAsync(msg).Result;
            }
                
        }


The complete code for program.cs would be like this:





using System;
using System.IO;
using System.Threading.Tasks;
using SendGrid;
using SendGrid.Helpers.Mail;
using System.Net;
using System.Configuration;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace HenryWebJob
{
    class Program
    {
        
        
        static void Main()
        {
            Execute();
        }
        public static void Execute()
        {
            string tenantId = "yourtenandid";
            string clientId = " yourclientid ";
            string clientSecret = "yourclientsecret";
            string restapiurl = " https://management.azure.com/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Web/serverfarms/{appserviceplan}/usages?api-version=2019-08-01";

            var token = GetAccessToken(tenantId,clientId,clientSecret).Result;
            if (GetUsage(restapiurl, token))
            {
                var apiKey = ConfigurationManager.AppSettings["AzureWebJobsSendGridApiKey"].ToString();
                var client = new SendGridClient(apiKey);
                var msg = new SendGridMessage()
                {
                    From = new EmailAddress("[email protected]", "DX Team"),
                    Subject = "henry",
                };
                msg.AddTo(new EmailAddress("[email protected]", "Test User"));
                msg.AddContent("text/html", "<html><body>There is Alert for File sytem usage.</body></html>");
                var response = client.SendEmailAsync(msg).Result;
            }
                
        }

        private static async Task<string> GetAccessToken(string tenantid, string clientid, string clientsecret)
        {
            string authContextURL = "https://login.microsoftonline.com/" + tenantid;
            var authenticationContext = new AuthenticationContext(authContextURL);
            var credential = new ClientCredential(clientid, clientsecret);
            var result = await authenticationContext.AcquireTokenAsync("https://management.azure.com/", credential);

            if (result == null)
            {
                throw new InvalidOperationException("Failed to obtain the JWT token");
            }

           
           return result.AccessToken;
        }
        private static bool GetUsage(string URI, String token)
        {
            Uri uri = new Uri(String.Format(URI));

            // Create the request
            var httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            httpWebRequest.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + token);
            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Method = "GET";

            // Get the response
            HttpWebResponse httpResponse = null;
            try
            {
                httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return false;
            }

            string result = null; 
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                result = streamReader.ReadToEnd();
            }
            Int64 currentvalue = Convert.ToInt64(JObject.Parse(result).SelectToken("value[10].currentValue").ToString());
            Int64 limit = Convert.ToInt64(JObject.Parse(result).SelectToken("value[10].limit").ToString());
            if (currentvalue < limit)//You can set your condition as your requirement
                return true;
            else
                return false;
        }
    }
}


Then schedule the webjob as every 5 minutes with Settings.job file.





{
  "schedule": "0 */5 * * * *"


  //    Examples:

  //    Runs every minute
  //    "schedule": "0 * * * * *"

  //    Runs every 15 minutes
  //    "schedule": "0 */15 * * * *"

  //    Runs every hour (i.e. whenever the count of minutes is 0)
  //    "schedule": "0 0 * * * *"

  //    Runs every hour from 9 AM to 5 PM
  //    "schedule": "0 0 9-17 * * *"

  //    Runs at 9:30 AM every day
  //    "schedule": "0 30 9 * * *"

  //    Runs at 9:30 AM every week day
  //    "schedule": "0 30 9 * * 1-5"
}




Publish the webjob to an webapp

In Solution Explorer, right-click the project and select Publish.   





Then go the webapp->WebJobs, can see webjob running as scheduled.







For more details regarding webjob, can refer following link:

https://docs.microsoft.com/en-us/azure/app-service/webjobs-sdk-get-started

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

%3CLINGO-SUB%20id%3D%22lingo-sub-2438420%22%20slang%3D%22en-US%22%3EHow%20to%20setup%20File%20system%20storage%20utilization%20alert%20rule%20for%20web%20apps%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2438420%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20following%20document%20indicated%2C%3CSTRONG%3E%20File%20System%20Usage%3CSPAN%3E%26nbsp%3Bis%20a%20new%20metric%20being%20rolled%20out%20globally%2C%20no%20data%20is%20expected%20unless%20your%20app%20is%20hosted%20in%20an%20App%20Service%20Environment.%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2FAzure%2Fapp-service%2Fweb-sites-monitor%23understand-metrics%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2FAzure%2Fapp-service%2Fweb-sites-monitor%23understand-metrics%3C%2FA%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ETherefore%20you%20may%20not%20use%20this%20metric%20for%20alert%20rule%20currently%2C%20even%20you%20can%20see%20this%20metric%20in%20alert%20rule%20setting%20UI.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20a%20workaround%2C%20we%20can%20create%20a%20WebJob%20to%20call%20following%20rest%20api%20%26nbsp%3Bthat%20can%20get%20%3CSTRONG%3Eapp%20service%20plan%3C%2FSTRONG%3E%20%E2%80%9C%3CSTRONG%3EFile%20System%20storage%E2%80%99%20%3C%2FSTRONG%3Eutilization%20and%20then%20sent%20an%20email%20if%20met%20exceed%20usage%20situation.%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Fmanagement.azure.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmanagement.azure.com%3C%2FA%3E%20%2Fsubscriptions%2F%7Bsub%7D%2FresourceGroups%2F%7Brg%7D%2Fproviders%2FMicrosoft.Web%2Fserverfarms%2F%7Bapp%20service%20plan%20name%7D%2Fusages%3Fapi-version%3D2019-08-01%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20my%20demo%20steps%20for%20your%20reference.%3C%2FP%3E%0A%3CP%3E1.In%20order%20to%20call%20resource%20manager%20rest%20api%2C%20firstly%20I%20created%20service%20principal%20that%20can%20access%20resources.%3CBR%20%2F%3E%3CBR%20%2F%3ESign%20in%20to%20%26nbsp%3BAzure%20Account%20through%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fportal.azure.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EAzure%20portal%3C%2FA%3E-%26gt%3BSelect%26nbsp%3B%3CSTRONG%3EAzure%20Active%20Directory%3C%2FSTRONG%3E-%26gt%3BSelect%26nbsp%3B%3CSTRONG%3EApp%20registrations%3C%2FSTRONG%3E-%26gt%3BSelect%26nbsp%3B%3CSTRONG%3ENew%20registration%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_0-1623401774775.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288019i7A1C0829D5961A49%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_0-1623401774775.jpeg%22%20alt%3D%22Henry_Shen_0-1623401774775.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ETo%20access%20resources%20in%20subscription%2C%20assign%20the%20application%20to%20a%20role%20as%20%3CSTRONG%3Econtributor%20role%3C%2FSTRONG%3E.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_1-1623401774784.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288020i332D91B29BF9C8D0%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_1-1623401774784.png%22%20alt%3D%22Henry_Shen_1-1623401774784.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ESelect%20the%20particular%20subscription%20that%20include%20your%20app%20service%20plan%20to%20monitor.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_2-1623401774786.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288018iD7763D67BBAE1125%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_2-1623401774786.jpeg%22%20alt%3D%22Henry_Shen_2-1623401774786.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3ESelect%20%3CSTRONG%3EAccess%20control(IAM)%3C%2FSTRONG%3E-%26gt%3B%3CSTRONG%3EAdd%20role%20assignment%2C%20%3C%2FSTRONG%3Eadd%20the%20%3CSTRONG%3Econtributor%3C%2FSTRONG%3E%20role%20to%20application.%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_3-1623401774790.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288021iEB8AD9CEC40C574F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_3-1623401774790.jpeg%22%20alt%3D%22Henry_Shen_3-1623401774790.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EGet%20values%20for%20signing%20in.%3CBR%20%2F%3ESelect%20%3CSTRONG%3EAzure%20Active%20Directory%3C%2FSTRONG%3E-%26gt%3BFrom%20%3CSTRONG%3EApp%20registrations%3C%2FSTRONG%3E%20in%20Azure%20AD%2C%20select%20your%20application.%3CBR%20%2F%3ECopy%20the%20%3CSTRONG%3EDirectory(tenant)ID%3C%2FSTRONG%3E%20and%26nbsp%3B%20%3CSTRONG%3EApplication(client)%20ID%3C%2FSTRONG%3E%20and%20will%20use%20it%20later.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_4-1623401774793.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288022iA53587139DC50C07%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_4-1623401774793.jpeg%22%20alt%3D%22Henry_Shen_4-1623401774793.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAt%20this%20%3CSTRONG%3EApp%20registration%3C%2FSTRONG%3E%2C%20Create%20a%20new%20application%20secret%2C%20select%26nbsp%3B%3CSTRONG%3ECertificates%20%26amp%3B%20secrets%3C%2FSTRONG%3E-%26gt%3BSelect%26nbsp%3B%3CSTRONG%3EClient%20secrets%20-%26gt%3B%20New%20client%20secret.%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_5-1623401774794.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288023i6B88F75EDD616225%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_5-1623401774794.jpeg%22%20alt%3D%22Henry_Shen_5-1623401774794.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAlso%20copy%20this%20secret%20for%20later%20use.%3C%2FP%3E%0A%3CP%3EFor%20more%20details%20for%20above%20steps%2C%20please%20refer%20below%20link%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Fhowto-create-service-principal-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Fhowto-create-service-principal-portal%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2.Create%20a%20new%20C%23%20.net%20Core%20Console%20app%20in%20the%20visual%20studio%20for%20the%20web%20job%20development.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_6-1623401828135.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288024i977681B7446CDA14%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_6-1623401828135.jpeg%22%20alt%3D%22Henry_Shen_6-1623401828135.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EInstall%20the%20latest%20stable%203.x%20version%20of%20the%26nbsp%3BMicrosoft.Azure.WebJobs.Extensions%26nbsp%3BNuGet%20package%2C%20which%20includes%26nbsp%3BMicrosoft.Azure.WebJobs.%3C%2FP%3E%0A%3CP%3EHere's%20the%26nbsp%3B%3CSTRONG%3EPackage%20Manager%20Console%3C%2FSTRONG%3E%26nbsp%3Bcommand%20for%20version%203.0.2%3A%3C%2FP%3E%0A%3CP%3E%3CEM%3EInstall-Package%20Microsoft.Azure.WebJobs.Extensions%20-version%203.0.2%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EInstall%20the%20Active%20directory%20authentication%20package%20in%20Visual%20Studio.%3CBR%20%2F%3EThe%20package%20is%20available%20in%20the%20NuGet%20Gallery.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_7-1623401828158.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288025i34BCA057C31C4F26%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_7-1623401828158.jpeg%22%20alt%3D%22Henry_Shen_7-1623401828158.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGet%20an%20access%20token%20for%20the%20app%20in%20C%23%20program.%3CBR%20%2F%3EIn%20%26nbsp%3B%3CSTRONG%3Eprogram.cs%3C%2FSTRONG%3E%2C%20add%20an%20assembly%20reference%20for%20the%20ActiveDirectory%20identity%20model%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Eusing%20Microsoft.IdentityModel.Clients.ActiveDirectory%3B%0A%0AAnd%20add%20a%20method%20to%20get%20an%20access%20token%20using%20previously%20copied%20tenantId%2C%20applicationId%20and%20client%20secret.%0A%0Aprivate%20static%20async%20Task%3CSTRING%3E%20GetAccessToken(string%20tenantid%2C%20string%20clientid%2C%20string%20clientsecret)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20authContextURL%20%3D%20%22https%3A%2F%2Flogin.microsoftonline.com%2F%22%20%2B%20tenantid%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20authenticationContext%20%3D%20new%20AuthenticationContext(authContextURL)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20credential%20%3D%20new%20ClientCredential(clientid%2C%20clientsecret)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20result%20%3D%20await%20authenticationContext.AcquireTokenAsync(%22https%3A%2F%2Fmanagement.azure.com%2F%22%2C%20credential)%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(result%20%3D%3D%20null)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20throw%20new%20InvalidOperationException(%22Failed%20to%20obtain%20the%20JWT%20token%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20return%20result.AccessToken%3B%0A%20%20%20%20%20%20%20%20%7D%0A%3C%2FSTRING%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20everything%20is%20set%20to%20make%20REST%20calls%20defined%20in%20the%20Azure%20Resource%20manager%20REST%20API.%3CBR%20%2F%3EWe%20can%20add%20a%20method%20to%20call%20a%20following%20GET%20REST%20API%20for%20%3CSTRONG%3Eapp%20service%20plan%3C%2FSTRONG%3E%20%E2%80%9C%3CSTRONG%3EFile%20System%20storage%E2%80%99%20%3C%2FSTRONG%3Eutilization%20%26nbsp%3Bwith%20the%20token%20gotten%20by%20above%20method%20and%20calculate%20if%20the%20current%20usage%20exceed%20limit.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%257bsub%257d%2FresourceGroups%2F%257brg%257d%2Fproviders%2FMicrosoft.Web%2Fserverfarms%2F%257bappserviceplan%257d%2Fusages%3Fapi-version%3D2019-08-01%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%7Bsub%7D%2FresourceGroups%2F%7Brg%7D%2Fproviders%2FMicrosoft.Web%2Fserverfarms%2F%7Bappserviceplan%7D%2Fusages%3Fapi-version%3D2019-08-01%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Eprivate%20static%20bool%20GetUsage(string%20URI%2C%20String%20token)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Uri%20uri%20%3D%20new%20Uri(String.Format(URI))%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20Create%20the%20request%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20httpWebRequest%20%3D%20(HttpWebRequest)WebRequest.Create(uri)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20httpWebRequest.Headers.Add(HttpRequestHeader.Authorization%2C%20%22Bearer%20%22%20%2B%20token)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20httpWebRequest.ContentType%20%3D%20%22application%2Fjson%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20httpWebRequest.Method%20%3D%20%22GET%22%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20Get%20the%20response%0A%20%20%20%20%20%20%20%20%20%20%20%20HttpWebResponse%20httpResponse%20%3D%20null%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20try%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20httpResponse%20%3D%20(HttpWebResponse)httpWebRequest.GetResponse()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20catch%20(Exception%20ex)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Console.WriteLine(ex.ToString())%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20false%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20result%20%3D%20null%3B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20using%20(var%20streamReader%20%3D%20new%20StreamReader(httpResponse.GetResponseStream()))%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20result%20%3D%20streamReader.ReadToEnd()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20Int64%20currentvalue%20%3D%20Convert.ToInt64(JObject.Parse(result).SelectToken(%22value%5B10%5D.currentValue%22).ToString())%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20Int64%20limit%20%3D%20Convert.ToInt64(JObject.Parse(result).SelectToken(%22value%5B10%5D.limit%22).ToString())%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(currentvalue%20%26gt%3B%20limit)%2F%2FYou%20can%20set%20your%20condition%20as%20your%20requirement%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20true%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20else%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20false%3B%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThen%20in%20the%20execute%20method%2C%20will%20send%20email%20if%20the%20usage%20exceed.%20In%20this%20method%20I%20used%20SendGrid%20to%20implement%20emailing%20feature.%3C%2FP%3E%0A%3CP%3EFor%20more%20details%20regarding%20SendGrid%20configuration%2C%20please%20refer%20following%20link%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsendgrid-dotnet-how-to-send-email%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsendgrid-dotnet-how-to-send-email%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Epublic%20static%20void%20Execute()%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20tenantId%20%3D%20%22yourtenandid%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20clientId%20%3D%20%22yourclientid%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20clientSecret%20%3D%20%22yourclientsecret%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20restapiurl%20%3D%20%22https%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%7Bsub%7D%2FresourceGroups%2F%7Brg%7D%2Fproviders%2FMicrosoft.Web%2Fserverfarms%2F%7Bappserviceplan%7D%2Fusages%3Fapi-version%3D2019-08-01%22%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20token%20%3D%20GetAccessToken(tenantId%2CclientId%2CclientSecret).Result%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(GetUsage(restapiurl%2C%20token))%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20apiKey%20%3D%20ConfigurationManager.AppSettings%5B%22AzureWebJobsSendGridApiKey%22%5D.ToString()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20client%20%3D%20new%20SendGridClient(apiKey)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20msg%20%3D%20new%20SendGridMessage()%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20From%20%3D%20new%20EmailAddress(%22loshen%40microsoft.com%22%2C%20%22DX%20Team%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Subject%20%3D%20%22henry%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20msg.AddTo(new%20EmailAddress(%22loshen%40microsoft.com%22%2C%20%22Test%20User%22))%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20msg.AddContent(%22text%2Fhtml%22%2C%20%22There%20is%20Alert%20for%20File%20sytem%20usage.%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20response%20%3D%20client.SendEmailAsync(msg).Result%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20complete%20code%20for%20program.cs%20would%20be%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Eusing%20System%3B%0Ausing%20System.IO%3B%0Ausing%20System.Threading.Tasks%3B%0Ausing%20SendGrid%3B%0Ausing%20SendGrid.Helpers.Mail%3B%0Ausing%20System.Net%3B%0Ausing%20System.Configuration%3B%0Ausing%20Microsoft.IdentityModel.Clients.ActiveDirectory%3B%0Ausing%20Newtonsoft.Json%3B%0Ausing%20Newtonsoft.Json.Linq%3B%0A%0Anamespace%20HenryWebJob%0A%7B%0A%20%20%20%20class%20Program%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20static%20void%20Main()%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Execute()%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20public%20static%20void%20Execute()%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20tenantId%20%3D%20%22yourtenandid%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20clientId%20%3D%20%22%20yourclientid%20%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20clientSecret%20%3D%20%22yourclientsecret%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20restapiurl%20%3D%20%22%20https%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%7Bsub%7D%2FresourceGroups%2F%7Brg%7D%2Fproviders%2FMicrosoft.Web%2Fserverfarms%2F%7Bappserviceplan%7D%2Fusages%3Fapi-version%3D2019-08-01%22%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20token%20%3D%20GetAccessToken(tenantId%2CclientId%2CclientSecret).Result%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(GetUsage(restapiurl%2C%20token))%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20apiKey%20%3D%20ConfigurationManager.AppSettings%5B%22AzureWebJobsSendGridApiKey%22%5D.ToString()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20client%20%3D%20new%20SendGridClient(apiKey)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20msg%20%3D%20new%20SendGridMessage()%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20From%20%3D%20new%20EmailAddress(%22loshen%40microsoft.com%22%2C%20%22DX%20Team%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Subject%20%3D%20%22henry%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20msg.AddTo(new%20EmailAddress(%22loshen%40microsoft.com%22%2C%20%22Test%20User%22))%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20msg.AddContent(%22text%2Fhtml%22%2C%20%22There%20is%20Alert%20for%20File%20sytem%20usage.%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20response%20%3D%20client.SendEmailAsync(msg).Result%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20private%20static%20async%20Task%3CSTRING%3E%20GetAccessToken(string%20tenantid%2C%20string%20clientid%2C%20string%20clientsecret)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20authContextURL%20%3D%20%22https%3A%2F%2Flogin.microsoftonline.com%2F%22%20%2B%20tenantid%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20authenticationContext%20%3D%20new%20AuthenticationContext(authContextURL)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20credential%20%3D%20new%20ClientCredential(clientid%2C%20clientsecret)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20result%20%3D%20await%20authenticationContext.AcquireTokenAsync(%22https%3A%2F%2Fmanagement.azure.com%2F%22%2C%20credential)%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(result%20%3D%3D%20null)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20throw%20new%20InvalidOperationException(%22Failed%20to%20obtain%20the%20JWT%20token%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20return%20result.AccessToken%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20private%20static%20bool%20GetUsage(string%20URI%2C%20String%20token)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Uri%20uri%20%3D%20new%20Uri(String.Format(URI))%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20Create%20the%20request%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20httpWebRequest%20%3D%20(HttpWebRequest)WebRequest.Create(uri)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20httpWebRequest.Headers.Add(HttpRequestHeader.Authorization%2C%20%22Bearer%20%22%20%2B%20token)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20httpWebRequest.ContentType%20%3D%20%22application%2Fjson%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20httpWebRequest.Method%20%3D%20%22GET%22%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20Get%20the%20response%0A%20%20%20%20%20%20%20%20%20%20%20%20HttpWebResponse%20httpResponse%20%3D%20null%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20try%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20httpResponse%20%3D%20(HttpWebResponse)httpWebRequest.GetResponse()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20catch%20(Exception%20ex)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Console.WriteLine(ex.ToString())%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20false%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20result%20%3D%20null%3B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20using%20(var%20streamReader%20%3D%20new%20StreamReader(httpResponse.GetResponseStream()))%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20result%20%3D%20streamReader.ReadToEnd()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20Int64%20currentvalue%20%3D%20Convert.ToInt64(JObject.Parse(result).SelectToken(%22value%5B10%5D.currentValue%22).ToString())%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20Int64%20limit%20%3D%20Convert.ToInt64(JObject.Parse(result).SelectToken(%22value%5B10%5D.limit%22).ToString())%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(currentvalue%20%26lt%3B%20limit)%2F%2FYou%20can%20set%20your%20condition%20as%20your%20requirement%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20true%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20else%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20false%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%0A%3C%2FSTRING%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThen%20schedule%20the%20webjob%20as%20every%205%20minutes%20with%20Settings.job%20file.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%22schedule%22%3A%20%220%20*%2F5%20*%20*%20*%20*%22%0A%0A%0A%20%20%2F%2F%20%20%20%20Examples%3A%0A%0A%20%20%2F%2F%20%20%20%20Runs%20every%20minute%0A%20%20%2F%2F%20%20%20%20%22schedule%22%3A%20%220%20*%20*%20*%20*%20*%22%0A%0A%20%20%2F%2F%20%20%20%20Runs%20every%2015%20minutes%0A%20%20%2F%2F%20%20%20%20%22schedule%22%3A%20%220%20*%2F15%20*%20*%20*%20*%22%0A%0A%20%20%2F%2F%20%20%20%20Runs%20every%20hour%20(i.e.%20whenever%20the%20count%20of%20minutes%20is%200)%0A%20%20%2F%2F%20%20%20%20%22schedule%22%3A%20%220%200%20*%20*%20*%20*%22%0A%0A%20%20%2F%2F%20%20%20%20Runs%20every%20hour%20from%209%20AM%20to%205%20PM%0A%20%20%2F%2F%20%20%20%20%22schedule%22%3A%20%220%200%209-17%20*%20*%20*%22%0A%0A%20%20%2F%2F%20%20%20%20Runs%20at%209%3A30%20AM%20every%20day%0A%20%20%2F%2F%20%20%20%20%22schedule%22%3A%20%220%2030%209%20*%20*%20*%22%0A%0A%20%20%2F%2F%20%20%20%20Runs%20at%209%3A30%20AM%20every%20week%20day%0A%20%20%2F%2F%20%20%20%20%22schedule%22%3A%20%220%2030%209%20*%20*%201-5%22%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPublish%20the%20webjob%20to%20an%20webapp%3C%2FP%3E%0A%3CP%3EIn%26nbsp%3B%3CSTRONG%3ESolution%20Explorer%3C%2FSTRONG%3E%2C%20right-click%20the%20project%20and%20select%26nbsp%3B%3CSTRONG%3EPublish.%3C%2FSTRONG%3E%20%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_8-1623402179130.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288029i645D3EC274037341%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_8-1623402179130.jpeg%22%20alt%3D%22Henry_Shen_8-1623402179130.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EThen%20go%20the%20webapp-%26gt%3BWebJobs%2C%20can%20see%20webjob%20running%20as%20scheduled.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Henry_Shen_9-1623402179138.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F288030i747B0EEB1C061B41%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Henry_Shen_9-1623402179138.jpeg%22%20alt%3D%22Henry_Shen_9-1623402179138.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20more%20details%20regarding%20webjob%2C%20can%20refer%20following%20link%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapp-service%2Fwebjobs-sdk-get-started%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapp-service%2Fwebjobs-sdk-get-started%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2438420%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E.%20NET%20Core%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20App%20Service%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWeb%20Apps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E

Version history
Last update:

‎Jun 11 2021 04:29 AM

Updated by:

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK