Migrate from Azure Function app to Azure Container app - c#

I have asp.net core REST API interacting with Azure Queue with input data. I have a Azure Function App with trigger on Azure Queue service. Whenever any entry that happens at the Azure Queue level, Azure Function app gets triggered which executes certain business functionality and returns the response.
After going the article : https://endjin.com/blog/2022/09/bye-bye-azure-functions-hello-azure-container-apps-part-2-migrating-from-azure-functions-to-asp-net-core , I am planning to migrate the Azure Function app to Azure Container app with gRPC based services.
I tried to explore few details https://learn.microsoft.com/en-us/azure/container-apps/samples but did not come across any good reference.
Here my challenge is how to trigger the gRPC C# services whenever any entry is added to the Azure Service Queue.
Can anyone help me here by providing some guidance?

Container Apps are built on top of KEDA, so any auto-scalers it supports (storage queues is one of them), you can use to scale your app but you lose bindings when moving away from Azure Functions.
Since bindings are not present anymore, you must use the Azure Storage Queues SDK directly in your code. So, you would call your gRPC service as you dequeue messages.
Container Apps are useful for HTTP triggered functions since you can use HTTP Frameworks like ASP.NET and leverage their complete feature set like built-in authentication, middleware, etc.
For other bindings, unless you have lots of custom code that need to run beyond the limits of Azure Functions or are perhaps trying to convert your existing non-Azure Function app to run serverless, you are likely better off using Azure Functions since most of the service-level binding code is taken care, reducing effort to maintain.
Obviously, if there is no binding support for your auxiliary service like IBM MQ or ActiveMQ, then you would want to use Container Apps instead.

Related

How to check the readiness probes on Services Bus?

I have an ASP.NET Core 3.1 application running on a docker container in kubernetes. It consists of two services which send data from the one to the other via Azure Service Bus.
Hot to check on the Service Bus a readiness probe?
I Was trying to find an API on https://learn.microsoft.com/en-us/dotnet/api/microsoft.servicebus?view=azure-dotnet and I did not found any fitting function.
Do you use it? Is it necessary?
There are some endpoints that can be used but are protected behind system/admin keys. But it seems that there is an issue already filed to expose endpoints for Kubernetes You can follow the thread for updates or you can also follow up on this thread.

Has Azure exposed apis to enable the resources creation in azure portal?

Has Azure exposed apis to enable the resources creation in azure portal?
I want to create a azure bot service through APIs from a different UI other than azure portal.
I want to create a azure bot service through APIs from a different UI other than azure portal.
It seems that you’d like to programmatically create BotService instead of creating it on Azure portal manually, if that is the case, you can try to use the following API:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}?api-version=2018-02-01
For more information about this API, you can check the API documentation: Deployments - Create Or Update.
Besides, Microsoft.Azure.Management.ResourceManager provides resource group and resource management capabilities for Microsoft Azure, you can use this client library with ARM template and parameters to create BotService programmatically.
To quickly get template and sample code in .NET for deploying BotService, you can go Azure portal to create a new Bot Service and click Automation options, then you can Download the template and find the .NET code sample.
Yes, here is the Azure REST API Reference:
https://learn.microsoft.com/en-us/rest/api/azure/

How do you integrate Application Insights into Service Fabric?

I currently use Azure Application Insights for logging on all of my Web API and MVC applications. Obviously the majority of this logging is automatic which is great. For events that I manually want to capture I have implemented a "LoggingUtility" which has methods like "LogError" and "LogInformation" that simply call Trace.TraceError and Trace.TraceInformation (the thinking is that the implementation of logging could be changed in one place in the future). The Trace is then captured by Application Insights.
I have started to develop some Stateful Services in Azure Service Fabric and cannot seem to find a way to use Application Insights. I have stumbled upon several articles pointing me towards a NuGet package that was in prerelease but has now been removed (https://www.nuget.org/packages/Microsoft.ServiceFabric.Telemetry.ApplicationInsights/).
Of course the Service Fabric templates generate the "ServiceEventSource" but firstly I cannot see how this would be useful for Application Insights and ideally I want all logging to be done through my "LoggingUtility" class.
Is it possible to integrate Application Insights into Service Fabric? If so, can I simply continue using Trace (via my "LoggingUtility" class)?
You have two options:
1. Using the Application Insights SDK in your LoggingUtility class to send information directly to AI
2. Using Windows Azure Diagnostics (WAD) to forward Eventsource traces to AI, using the provided EventSource class in the SF project templates. That class you can modify to be your LoggingUtility class implementation.
Considering that you are running your SF cluster in Azure, the second approach is the current recommendation, as Service Fabric system service events are also using Event Tracing.
For configuring Azure Diagnostics to AI, follow the steps outlined in this article: https://azure.microsoft.com/en-us/blog/azure-diagnostics-integration-with-application-insights/
Be aware this article targets Cloud Services and VMs, but just use the VM Scale Set for configuring Azure Diagnostics in stead of a VM. That should work.
The NuGet package is no longer supported: https://social.msdn.microsoft.com/Forums/en-US/f0f1ad78-4d83-48e5-b1da-4a9f0eddb9b2/application-insights-for-service-fabric?forum=AzureServiceFabric
We used the new Microsoft.Extentions.Logging and wrote a insights logger - it gets the service fabric messages via Trace we also pulled out all the ETW stuff it doesnt add much .

Can we replace Azure Portal by our enterprise Client app to perform all tasks that we perform on azure protal

Does Azure offer full APIs to accomplish all tasks without opening azure portal.
I heard some REST APIs are available but not sure about their coverage.
My questions is can we replace Azure portal completely by our customized enterprise App which actually calls REST APIs provided by Azure.
here is Why I need this strange thing
We need this as our organization is developing a Internal Unified App to manage our resources on all three cloud Azure,AWS and Google Cloud from single point..
The answer to your question is yes. You can certainly do that. As Alex mentioned in his comments, take a look at Azure Service Management API to begin with.
However there are a few things I would like to point out:
As you know there are two portals right now (Live and Preview). Unfortunately both of these portals use different sets of API. Live one uses Service Management API and the Preview one uses Azure Resource Manager (ARM) API. So you have to make sure that you use both of these APIs in your application. Though Microsoft is pushing very hard to make all the APIs exposed through ARM API but there's still a lot of work that needs to be done.
Another thing I noticed is that at times documentation for REST API for certain services is missing though there are ways to find that information. Just keep that in mind if you're building support for these services and not able to find documentation.
I would suggest you start here: https://msdn.microsoft.com/en-us/library/azure/mt420159.aspx and then find out REST APIs for the services you're interested in supporting in your application.

HTML5 with .NET backend App, compatible with both standalone Windows and Azure?

I need to design an HTML 5 responsive, and simple app that should work on both internal Win server and on Azure.Our Client wants to check out Azure but maybe later he will want this app to be on its own on premise servers. Our Developers are almost all .NET back ends, with basic knowledge in HTML 5, Javascript, Jquery, and bootstrap. We accepted the challenge because the project is tiny and interesting, the point is, is possible to have 1 project that can be deployed to azure or IIS with no problem? and what kind of project should we create? I think that a simple asp.net project with some web methods and js will do the job, but I don't know if it will work on azure too. Back n 2010 I did something that way but now I am not sure it's still valid
Important: the web application should be able to query oracle on premise server, via web service but not sure if take azure service bus or azure vpn
It depends on how you build your application. I have built applications in the past that works both on-premise and on Azure. As long as you don't access any Azure specific features, there's no problem to deploying the web application project to an on-premise IIS.
If you use Azure-specific features or services from Azure, such as Azure SQL DB, you have to built an on-premise version. In my case it was simple as changing the connection string and the rest was done by Entity Framework, but you can use an IoC container, such as Unity, to change your implementation based on the environment you're running on. If the Azure environment is available (check through RoleEnvironment.IsAvailable) you resolve the Azure-specific implementation of some features and if not the on-premise implementation. In most cases that are just a few dependencies, for example if you use a worker role on Azure and a Windows Service on-premise.

Categories

Resources