Deploying Azure Functions to a specific function within multiple without overwriting the others - azure

I have 2 Function Apps in Production with several functions each.
When I want to deploy the VSCODE project of specific Function (project) the prompt asks me to choose the Function App to deploy to, and after I'm choosing the right one - it actually deploys the same set of functions to the other Function App as well.
These are the functions inside - it's always identical even deploying from different project:
I'm trying to figure what am I missing here.
Any help is appreciated. Thx

Solution is found.
It happened to be that the configuration of WEBSITE_CONTENTSHARE had the same value for both Function Apps.
Changing that to a unique value per App fixed the issue and now we can deploy each bundle to the relevant App.

Related

Set up Azure Application Insights for local environment

We have set up Application Insights for our Dev & Prod environments, not with the SDK but through the Portal. We're now in the process of installing the SDK so we can have more control over customizing logging, what to measure in performance, etc.
I have found how to separate the environments in code (separate Instrumentation Key in different config files etc), but I have found nothing when it comes to my local environment. Which instrumentation key should I use there, the dev one? Wouldn't then this skew our dev metrics everytime one of the developers runs the app locally?
And also, doesn't it make sense to have a separate App Service slot just for the local environment, so I can test everything and see the logs I'm trying out locally, and not have to deploy to dev everytime I want to see what I'm doing?
I've tried creating a separate slot for local, but it generates a weird url based on the name I give, which I can't change later.
I've googled for a couple of days already and couldn't find any (or very little) helpful advice when it comes to this.
I realise there is a "Just add the SDK to try local only mode" option in Visual Studio, but then I would have to use it exclusively locally. What I want is to use all three - my local, dev & prod.
We're using .net core 2.2 for our backend and Angular 7 for front end.
I'm an idiot.
The url set up automatically basically means nothing. I solved the problem by just adding another App Service slot (created from our App Service production one, just like dev), and added this key to the local settings in our project.
Now we can use this key to get real time results as we debug, and use the other two for dev & production.

Deploying an Azure Function from VS Code - Succesfull but not visible in the Portal

I created a function and I am trying to deploy it from VS Code by clicking the Deploy to Function App.... The Deployment runs successfully based on the output log - Deployment successful but then when I go to the portal, the function is not listed under Functions.
What shall I do and what is the problem here?
When I debug in VS Code, I get this: No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
Unfortunatly I would not know if those steps don't work for uploading. The deployment finishes, and every single time it becomes visible in my portal. Uh, maybe there is a slight difference. The app service itself is pre-created via terraform. Just the uploading of the code I do via VSC.
As far as deletion goes:
Open the resource group, in the list lookup the App Service. Select the checkbox in front of it. Delete in the top nav bar of that pane.
Trying to delete it any other way will indeed give you the "Not found" error.
I've had the same 'issue', in my case it turns out that the issue was a bad entry in the requirements.txt
I had an incorrect line with 'io' and when it was present despite the deployment appearing to complete successfully in VS code, the function was not updated if it was previously deployed or not deployed if it wasn't resulting in the same 'no results' in the functions list.
Having other requirements such as 'numpy' or 'scipy' worked just fine.
It's an old thread but maybe it'll be helpful to whoever gets here in the future.
Even as of now, some changes I make in VS Code seem to take time to be immediately visible on the portal. I had a similar issue with resources, i.e. creating a resource from VS Code wouldn't make it immediately visible on Azure Portal. You can always go to Functions on the portal and click Refresh. Also try going to Advanced Tools, then Kudu and checking if your function can be found there.
One word of advice: if you publish your functions from VS Code, then work on that resource only from VS Code. You will find it reiterated all over Azure Functions docs that:
Publishing to an existing function app overwrites the content of that
app in Azure.

Azure Functions publishing

Firstly I would like to describe my local project structure. I have three Azure Functions v2. Locally each function have separate project. The fourth project is library which functions are using.
I would like to publish those functions into one function on Azure ( one App Service). And there's the issue occurs.
Let's start with an example. Let's say the function names are : A, B, C.
Firstly I publish functions in order: A, B, C. Then I've change something in function B, and publish only B. Then the function A, and C are not working.
I've must publish all functions to work again.
My first thought was package incompatibility and resolved that. But the issue still occurs. The web publish file does not contains any info about any additional packages/dlls.
Do you have any tips?
Your intention itself that publishing several Function projects to one Function app is incorrect.
See the official guidance.
In most scenarios, the unit of deployment should be the Function App, and not individual functions. Deploying a Function App is essentially identical to deploying a Web App.
Locally one Function project represents exactly one complete Function app, so one Function app should host only one published Function project. Otherwise we may see inconsistent behavior after publishing which results from content overwritten and so on.
My suggestion is to put functions together in one project, merging usually doesn't bring trouble unless there are specific host settings for each project.

All Function Apps turn to Read only mode after publishing Azure function project via Visual Studio 2017

I have a Function Apps created via Portal, another one created by visual studio. The latter one cause both apps to become read only, with message below:
Your app is currently in read-only mode because you have published a
generated function.json. Changes made to function.json will not be
honored by the Functions runtime
Is this feature correct?
VS: 15.8.5
Yes, this is by design. Function Apps you mentioned should be called functions in one same Function app.
You create a Function app and a function on portal, then in VS you actually also create a Function app instead of a separate function. After you publish this pre-compiled Function app to the one with some existing functions, Azure thinks you want to use the new published one, so it sets the app to be read-only as we can't modify pre-compiled assets on portal unless we republish our code.
This action is by design because one Function app(with functions inside) is handled as a complete unit. So apparently it's not recommended to mix online development with pre-complied one.
Two choices for you to refer.
Remove existing functions in the app. Check Remove additional files at destination when publishing from VS.
Create another Function app.
There are risks that mixing online and pre-compiled code from VS, for example
Name restriction. Functions created online will be overwritten if we publish functions with same names.
We can't check Remove additional files at destination even though some pre-complied dlls published before have been useless.
If it's only for test or there's no worry about potential risks, just change Function app edit mode to readwrite in Function app settings or add FUNCTION_APP_EDIT_MODE readwrite in Application settings.

Functions published as a VS2015 Web Application not showing up in the portal list

I followed the roadmap to create a set of Azure Functions as a Web Application. They deployed without an issue to my Azure Function App.
I moved the project to a new solution and changed the name spaces and updated the function.json files. When I redeployed to the Function App I was getting a bad entry point on one function which I double checked and tried to update a couple of ways without any success.
Thinking that the Function App might be caching I tried restarting the app and then finally went into the App Service Editor and deleted all the files and republished. Now none of the functions show up in the list even through the directories and function.json files for each function are confirmed present.
Has anyone else experienced something like this or have a suggestion as to how to resolve it?
It looks like your script file in function.json is set to a dll that doesn't exist in bin. Double check the dll name there.
You can see the content of bin folder on azure through debug console by going to https://<yourAppName>.scm.azurewebsites.net/DebugConsole

Resources