The Microsoft Azure Functions team hosted a special Ask Me Anything (AMA) session on Twitter, Thursday, October 11, 2018 from 9 AM to 11 AM PST. Questions to @AzureFunctions or @AzureSupport with #FunctionsAMA about the service were answered.
We took an effort to blog the session that will help you to refer the questions and answers from one place rather than scrolling in your twitter feed.
- How many Azure Functions are being created every day? Approximate volume?
Infinite, the number fluctuates based on day of the week, seasonality and other factors.
- What is the future for using Python to author Azure Functions?
We’ve re-introduced Python support on the 2.0 runtime. The feature is currently in private preview. Everything you need to get started is available here.
- Does Azure Functions are used internally in Logic Apps?
AzureFunctions can be called from Logic Apps, but they do not share a code base. More details here.
- I want to use a function to communicate with an HTTP-endpoint, but there is a token mechanism that has to run as a singleton. Can I throttle a function to prevent scaling, like a singleton, or a specific number of instances?
This should solve your problem with single calls https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-singletons. You’ll probably also need to remember the requests that you’ve temporarily ignored. ServiceBus Queues can help you with that.
- Any existing (prototype?) bindings available to listen to an AMQP queue, publish to exchange, etc. If not, we’d be willing to pair up to write a binding if that is possible, especially if there is another community interest.
Nothing I’m aware of today, but it should absolutely be possible. You could try writing a small output binding that uses AMQPLite (https://github.com/Azure/amqpnetlite) as that supports .NET standard. Triggering off a queue is harder because our extensibility model doesn’t include triggers yet.
- Is there any standard way to use DI in Azure Functions v2.0?
DI features are not currently exposed in 2.0, but something we’re actively working on and should be landing soon.
- Any recent example of a Graph API?
Nothing new, really. Existing guidance is here.
- What is the recommended method of interacting with an Azure SQL Server database in a Python function on the 2.0 runtime within a consumption plan on Linux? Without kudu available, having trouble configuring ODBC drivers for pyodbc.
- With containers on Azure Functions is it possible to deploy any type of application, does it require a dedicated App Service plan?
Currently, the bring-your-container offering is only available on an App Service Plan. You can publish your own custom image to this plan. For the best FaaS experience, we recommend extending one of our base images here to build your own docker image.
- Any plans to add Dependency Injection in v2.0?
Absolutely! We discussed this a bit in our last webcast here. The core work has been done prior to GA and we’re now finishing up feature work and documentation.
- I want to create a C# library (.net standard) that I can use both from Functions and other apps; the library will access Azure Storage. What version of the Azure Storage library do I need to reference from NuGet?
In 2.0, there is no restriction on the version of the Azure Storage SDK you can use, but keep in mind that if you want to use the storage binding, you need a version that supports the storage version you want to use. There’s only one release at the moment, supporting 9.x.
As new versions of the Storage SDK come out, we’ll have updated storage bindings targeting them and giving you the ability to adopt those updates.
- I would like to know the roadmap of Functions runtime 1.0 and the consequence in retaining of runtime 1.0, typically it is recommended to upgrade to 2.0, but assemblies like SharePointOnline aren’t fully compatible under .NET Core.
We will continue to support 1.0 for a while, as there are plenty of customers with .NET Framework production applications relying on it. However, we do recommend everyone to migrate to 2.0, as that’s where we’ll be lighting up new features and improvements moving forward.
- Any timeline for OpenApi Definition support in v2.0?
Open API definition support was a preview feature in v1.0. Given the huge customer interest, we’re planning on bringing it to v2.0 as well but no timelines yet. Since the runtime is open source, you can tune into the backlog here.
- Will App Services get a consumption plan?
If you’re asking about App Service being able to scale from 0 instances and up, then that is not currently planned. The initial scale unit has been 0, from whatever size of App Service Plan you need to use, based on traffic expectations and feature sets provided.
- Is it possible to use SFTP/FTP as input/output without resorting to kludges like API bridge?
We don’t have any FTP related bindings today. You’ll need to use an FTP client from your function code.
- Is it possible to listen for on-prem MSSQL DB table row changes or inserts, as you can with CosmosDB?
We were able to build functions triggers for Cosmos thanks to the awesome change feed infrastructure and supporting library (see link). MSSQL does not have an equivalent, unfortunately (the closest is this article).
Best I can suggest right now – build a small application you run on premise that uses the query notifications feature from SQL that then writes messages to a cloud-hosted queue (Azure Storage or Service Bus) that you trigger your functions off.
- Will, it ever be possible to deploy an entire ASP.NET Core app as a Function app
Though this is something we’ve discussed and prototyped, it isn’t something we’re currently tracking, but would definitely recommend upvoting this here and sharing your exact use cases.
- How do you access an Azure SQL Server database in a Python function on the v2.0 runtime within a consumption plan on Linux?
You can use the pyodbc module to connect to an Azure SQL database. More information about how to install and use this module is available here.
- Ran into issues with v2 function in VS Code when executing the “extension install” cli command for service bus triggers. The extension.json in publish file was empty. Ultimately had to go through VS proper to get it working. Any ideas?
Thanks for reporting, this is definitely a bug. Can you please file an issue here with more details.
- Can the runtime be built and run on a Linux machine? If it’s a NO, you should definitely work on it as it would open more contributors to contribute and more people using it on premises?
It definitely can! Read here. Yes! The 2.0 runtime is based on .Net Core so it can run on any platform. Since we’re open source, you can also build the runtime locally or run it on-premises. More information here.
- Do we have any code samples which we can use to write Mock unit tests for Azure Functions? I can find some samples for Durable Functions but not for the normal Functions?
There’s a great series of posts here by Jeff Hollan that talks about testing and related CI/CD workflows for Azure Functions.
- Have you identified the bottlenecks that allow AWS lambda functions to respond from cold and scale faster than Azure Functions and are they a priority on the backlog? Not that performance is bad now, just curious.
Yes, there are several potential improvements that we are exploring. For example, if you are running from a package (see this article), we think we can further optimize how quickly we can get that package onto the appropriate VM.
- Is it possible to validate a user’s claim against Azure AD for their rights to execute/trigger a function?
Nothing built in yet (something I’m eager to do). Today, you’d have to author that code yourself using the incoming identity information. Most of that comes in on headers, but very soon you’ll have an actual object representing the Claims Principal.
- Best practice question we can call Azure Functions using Logic Apps why then we need durable Azure Functions?
Honestly, which to use depends on your preference – whatever makes you most productive. Some like the visual workflows; others prefer code. Logic Apps also has some nice integration capabilities with those 200+ connectors. We actually see quite a few folks using both together!
- What are the most interesting applications of Azure Functions you’ve come across?
Here’s one great example from Troy Hunt.
- What are limits on Azure Functions? How can we use them as an API to handle a million users of an app that could produce 1,000 users hitting them at once?
A single function app can handle thousands of HTTP requests per second. Combine that with Azure Traffic Manager and multiple function apps to get geo-distribution and redundancy and you’ll have a solution that can support millions of users.
- Do we need to try catch to log exceptions to App Insights? Can’t this be a default behavior even if there is no catch block?
If your function throws an (unhandled) exception, it will be logged to App Insights automatically. If you’re seeing anything different, can you file an issue over at Github and I can help try to track it down.
- How do you hook up pre/post hooks to log messages to ELK?
There’s no explicit way to hook into ELK today. However, we’re working to support Azure Monitor, which will provide more flexibility for routing logs to other systems. Read More
- Thoughts on long-term overlap (I think subsuming) of web API with HTTP triggered Azure Functions
When adding new features, we carefully examine what is available from Web API/MVC and reuse or leverage the same model when it makes sense, and have something that is WebJobs/Functions specific when it doesn’t.
Full parity is not a goal, but we have explored the ability to host asp.net applications in Functions and that is something that may eventually happen (not currently tracked)
- Do you see room for any major improvements to the cold start problem?
We have a few activities which will help, from general improvement to the runtime and also the introduction of Premium Functions. Cold start is a byproduct of any platform running serverless due to the code being loaded onto the machine for the first call after a given period of inactivity. Reach out for questions about Premium if you’d like, full preview announcement will be coming soon!
- I’m confused about the pros/cons of Premium plans vs App Service plans. Is there a comparison grid available (can email me)? Are there any cons to Premium vs AppService, ie why would anyone not use Premium?
- Premium is still only in private preview, it will be a while until it’s fully supported.
- App Service will give you predictable pricing vs. more dynamic with Premium Functions.
- Feature sets are not yet fully defined for the Premium Functions plan.
- Can you add a DLL while implementing Azure Functions?
Yes! If you’re writing your function in visual studio, just add a reference to your library. If you’re doing C# in the portal, see this article – let me know if I didn’t cover your particular scenario.
- Is there any API available for retrieving the invocation logs of Azure Functions with pagination and date time filters?
The standard logging/monitoring solution is now Application Insights, they expose a few different options to retrieve data, including this: https://dev.applicationinsights.io
- Orchestration 1: Recurrence triggered Logic App run once daily to call Azure Functions, function retrieve data from DB, Logic App send email to customers. Orchestration 2: Timer triggered function fetch data from DB, send email by send grid output binding. Which is reliable & efficient?
If Orchestration 2 is a single function, definitely prefer Orchestration 1 with the Logic App. Durable Functions would also be a good fit, but in either case, you want some checkpointing between actions in order to get your reliability target. Orchestration 2 might be slightly faster, but negligible.
- Azure Functions v2.x supports only .Net Core, is there any plans to bring support for .Net Framework? Is this in the pipeline or do we need an intermediate .Net Standard project between Functions and our Framework projects?
No plans to support running on full framework. You can still reference dependencies targeting full framework, with the same caveats/restrictions as a regular .NET Core app.
- What are the parameters that influence my Azure Functions billing? Is it only the executions or Memory consumed also has a role to play?
Both – number of executions and resource consumption play a role in the billing. More information available here.
- While retrieving the metrics for Function apps using Azure Metrics API, we are getting the metrics of websites sometimes. Is this a bug?
Possibly. Can you file an issue over on Github? We can get some details from you and investigate.
- Is it possible to maintain versioning of the Azure Functions apps using deployment slots? If so will it be maintained for all the deployment slots of an Azure Function app so that we can swap between the versions of the production slot whenever needed?
Yes, you can use deployment slots for versioning. The feature is still in preview on the consumption plan.
- When using worker roles for background processing finding worker roles is bit expensive, can we replace it with Azure Functions? If yes will it handle long running process? scale automatically on load? spin multiple threads in a function? Does it reduce expense?
Yes, functions is often a good replacement for worker role workloads. You can spin up multiple threads, yes it can scale on load, and many of our customers report reduced costs when running in consumption plan. You do need to keep your executions short though.
- Is it possible to get only the metrics specific for function app and not for a particular function inside a function app using Azure Metrics? How to get Function specific metrics?
You can get function specific metrics from App Insights to see https://docs.microsoft.com/en-us/azure/azure-functions/functions-monitoring#category-hostaggregator Azure Monitor/Metrics has function app level metrics.
- Do Azure Flow and Logic Apps share the same underlying code?
We’re not the best team to answer that, but as far as we know, the underlying workflow engine is the same. Our friends from Logic Apps team can expand on that if needed.
- How goes the out of the box DI work and when do you think it might be released?
We’re making progress on that! Don’t have an official ETA to share, as this will be quality driven (including documentation), but we’re hoping to have this available by the end of the year.
- Is PowerShell Remoting supported?
I assume you mean remoting from functions to some other machine? It might be possible. I suggest you try it out. PowerShell remoting might depend on functionality that is blocked by the App Service sandbox. You could test that through kudu console.
- Azure Functions seem to be a great match to handle external public but throttled APIs. Will, you provided a way to make sure no more than one instance of a Function is running?
Durable singletons are another possible route you can take. Read More
- The template for a C# Azure Function includes a “log” parameter to Run(). What is the recommended way to capture anything logged to that, in a persistent way (blob or file)?
The recommended way is to hook up to App Insights – https://docs.microsoft.com/en-us/azure/azure-functions/functions-monitoring. We’re also working to support Azure Monitor to provide more options for log storage: https://docs.microsoft.com/en-us/azure/azure-monitor/overview That work is being tracked here.
- If I just get a 404 not found, where is best to look for the problem with nodejs v2.0 functions
Can you file an issue for us over at Github? We’ll get somebody to grab more details from you and we can investigate.
- What do the Azure Functions team members do for fun? Does it help deal with the horde (of engineers who constantly need your attention)?
Aside from doing AMAs? We really enjoy long walks on the data center and making artisanal servers. Also, for dealing with the horde, it helps that the team scales dynamically. But seriously, Seattle is gorgeous, and lots of folks on the team hike and ski when weather permits.
- I have an Azure Function needing to call an external Service, there is a need for whitelisting the outbound IP addresses. Is there support for aggregating the numerous IP addresses into just 1 & have that whitelisted purely from a PaaS perspective?
Chatted with a few folks – not aware of anything for this.
- Is versioning in Azure Functions be integrated?
Have you tried using run from package (https://docs.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package)? It makes versioning really easy. Switching between versions is as simple as changing the URL for your package.
Note: The answer thread in Twitter conversation may have been continued even after this blog is published.
Serverless360 is a one platform tool to operate, manage and monitor Azure Serverless components. It provides efficient tooling that is not and likely to be not available in Azure Portal. Try Serverless360 free for 30 days!