Function Inside a Webjob Not Showing In Dashboard - azure

I may very well be not understanding how this works, but I thought I was doing pretty good up until now.
I have a Azure Storage Account setup for my WebJob Dashboards.
In the application settings of my WebApp I am setting a Connection String AzureWebJobDashboard of type Custom and it has the connection string to that storage account.
In my Webjob I have the following code:
[FunctionName("ProcessIncomingCustomerQueue")]
public static void ProcessIncomingCustomerQueue([QueueTrigger("incoming-customer")] string message, ILogger logger)
{
When I start the webjob, is acts like it is finding everything correctly.
No error message about needing to configure the AzureWebJobDashboard.
When it starts it finds the function per the log:
But when I click on Functions on the top right it says "No functions are present".
Is that not what that is for, to show the functions that are in the webjobs?
Thank you --
Joe

Azure Functions and Azure Web Jobs are 2 different (but related) technologies.
Web Jobs run as part of your Web App. Azure Functions are running separate from your Web App.
If you want to have an Azure Function, create a Function App Resource in the Azure portal and use either the Web Portal to write your code or create a Azure Function Project in Visual Studio and deploy it to that resource.
You can also use Visual Studio Code and the Function CLI to create Azure Functions.
Find details and quick starts here:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function
https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-your-first-function-visual-studio
https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function-azure-cli

Related

Why Azure WebJobs blade is showing no webjobs

Basically i am curious why the WebJobs blade for my App Service shows 0 webjobs ("You haven't added any WebJobs. Click ADD to get started"). And of course, when i click Add, i get "WebJob cannot be added from portal if development from source control is configured.").
I am following this guide. As with almost any technical guide, things get outdated very quickly and frequently. So i'm trying to following this the best i can.
Note that my snippet (taken from the link) essentially looks like this:
class Program
{
static void Main()
{
config = new JobHostConfiguration();
var host = new JobHost(config);
host.RunAndBlock();
}
}
To paraphrase: I am not see my WebJob under my App Service.
Question:
Based on this link/guide, the WebJob simply exists in the solution. There is the Program.cs (the entry point of the app service/host), and then there is the WebJob itself ( Functions.cs, which has a basic implementation with a QueueTrigger("queue") ). Why is the WebJob not showing up under the WebJobs blade under the App Service?
If you have source control configured with your application, the webjobs should be deployed as part of the source control integration.
Form App Service perspective a webjob is just part of the content of the app.
If you deploy a webjob through the portal and then had a commit to your source control, then the webjob would be removed since it wasn't part of the payload being published by source control.
The right way to do this is to make sure webjobs are part of your solution.
As a workaround, you can deploy webjobs through FTP/FTPS but keep in mind they will be removed the moment source control does the next deployment.
Or you could upload the webjobs directly via the Kudu Console.
Open the Kudu Console by selecting "Advanced Tool" --> "Go" in Your App Service on the Azure Portal then Go to the directory for your webjobs: d:\home\site\wwwroot\app_data\jobs\continuous\{job name} drag and drop the .zip file you prepared to upload your webjob

How to deploy single cshtml file in Azure app service

I have a .Net core app developed using Visual Studio 2019 and deployed on Azure app service. I have function app as well in the same solution. I have to do couple of things and then redeploy to Azure app service.
Add one .cshtml file
Modify one .cshtml file
My question is, how to deploy the CSHTML file only to the Azure app service? Without affecting the existing functionality of application.
As per my understanding, if web app is deployed in Azure app service then the whole thing (solution) has to be deployed even though there are/is very small code modifications.
Please let me know.Thanks.
Even if you have Web App and Function App in the same solution, they should be separated units of deployment. That said, your deployment pipeline should be separately triggered for Web App and Function App.
From the technical point of view(or architecture) there's no concept of "solution". Solution(.sln) is a Visual Studio specific being and even though it's supported e.g. in VS Code, I'd never treat it as deployment unit. Especially in your scenario, when in fact two separate services are responsible for handling your code.
Even if you deploy Function App as a part of the same App Service Plan as your Web App, it's still a separate Azure service. In such a scenario they only share compute.
Yes its possible if you have access to kudu deployment center you can perform manual add/update information , please visit below URL:-
https://[yourAppName].scm.azurewebsites.net
You can also navigate to this site using the azure portal , once you open the app service blade you will find the kudu deployment center option in the bottom left of the menu.
It will provide an online file explorer of your application hosted on the app service and from there you can migrate to relevant folder and perform add/update.

How to add Function App to Resource Group project in Visual Studio 2017?

I'm working on my Azure project for gaining some experience especially in deployment via Powershell. I already created a solution, and added an Azure Resource Group deployment project. Here you can add resources to your group, but there is no Function App, WebJobs or anything similar to Function App, or FaaS stuff.
I checked the automation script created by Azure portal about a manually created Function App, but it is quite heavy. It will take time to figure out how it works.
Is there a way to do it using this tool?
There are two pieces to this puzzle.
1) Is the "Infrastructure as Code" or IaC. In your case the Azure Functions PaaS Service. This can be deployed using an Azure Resource Manager (ARM) template, built using Visual Studio 2017. This is the "runtime/host" that your function will be deployed to. See the Azure Resource Group deployment project type, part of the Azure SDK. Top tip - if you have an Azure Resource Group with a Functions PaaS instance in it, go to the instance and click on Platform Features -> Automation Template. This will give you the foundation for building your resource group deployment project.
2) Is the function itself. This needs to be deployed to your Azure Functions PaaS service. Azure functions have their own project type in Visual Studio 2017, however the template needs to be download. See Visual Studio 2017 Tools for Azure Functions.
Once you have built your function using (2) above, you publish to your function PaaS instance deployed (which was either manually deployed or deployed using (1) above).
Top Tip 2: You can build and test functions locally using the Azure Functions CLI.
Top Tip 3: Use the Azure Resource Explorer to help understand how the ARM structure looks for your subscriptions.

Can't run Azure WebJob ManualTrigger attached to Azure WebSite

I have created an Azure WebSite in Visual Studio. I then added a Azure WebJobs project through Visual Studio. I then provided the connection string to my storage account to both the app.config file of my WebJob project and the web.config file of my WebSite project.
I still cannot get the job to complete successfully. It keeps failing, as I can see that on the Dashboard. When I go to the Dashboard, not only do I see the job failing every time I run it, I also get a red notification that my connection string is incorrect for the AzureWebJobsDashboard. I've provided this connection string in both projects, and I've copied from the Azure Portal, so there is no way I'm getting the connection string wrong.
How can I fix this? I'd like to start creating real WebJobs, but I can't even get the example one to work (the one given to you as a ManualTrigger when you add a WebJob project in Visual Studio).
update
I had forgot to mention that this connection string is also in my application settings in the azure portal already and I still see failures.
Try adding the connection strings on the Application Settings page of your WebApp in azure.
UPDATE
Use a General-purpose storage account to get rid of
System.InvalidOperationException exception.

Azure Functions - Visual Studio Tools

I was trying to create Azure Functions as provided in the help link - https://blogs.msdn.microsoft.com/webdev/2016/12/01/visual-studio-tools-for-azure-functions/
I am actually creating a Evenhub trigger to write the messages to blob storage.
When I try to run the project, I am getting an error:
"Microsoft.Azure.WebJobs.Host: Error indexing method
'Functions.DashPOCEventHub'. Microsoft.WindowsAzure.Storage: Value
cannot be null."
I have put the correct values in the appsettings.json.
Can somebody help me with this error?
Also, when I try to publish the function to Azure, the appsettings.json is not being set correctly. I cannot see the values and keys when I go into the Azure UI application settings page.
appsettings.json won't create/override your web app ApplicationSettings when you deploy. You'll need to specify the ApplicationSettings for the web app explicitly.
The reason for this is so that you can use different secrets locally (appsettings.json) from what you deploy (web app appsettings).
There is more info on appsettings.json and web app Application Settings here.
Silly John, did you update the Azure CLI when you run your Function Locally? Today is on the Azure Functions Console CLI 1.0.0-beta.97.
Probably, this update solves this issue.

Resources