Posts

Dependency Injection for Azure Function

Enabling dependency injection on your Azure Function a little bit different than the usual process like you do on the .Net Core applications. Here I'm planning to share some tips and steps you should follow if you need to enable DI on Azure Functions with C#. I'm focusing on a function application created for HTTP Trigger. When you create a new project you will see a static class and method to run your function end-point.  1 2 3 4 5 6 7 8 9 10 11 public static class FunctionWithDI { [FunctionName("function-with-di")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation( "C# HTTP trigger function processed

Dependency Injection for .Net Core console application

Image
As many organizations are now migrating their on-premise applications to the cloud platform now there are many requirements to convert legacy .Net application written in .Net Fullframework to .Net Core.  In this article, I want to share a simple way to enable the .Net core dependency injection, especially on a console application. If you create a new Asp .Net Web API or Web App the project scaffolding template will provide you the initial code for dependency injection. But console applications you will need to do as below. First I will start by creating a new project. I use the visual code terminal to create a new project called "sample-console-app" so the project name will be constructing from the directory name where you execute the below command.  > dotnet new console The above command will create you the project and you will see your project view like below. You can run the below commands to restore dependencies and run the application. > dotnet restore > dotn

How to enable Remote Desktop on Azure Cloud Service

Image
Azure Cloud Service is one of the very useful PAAS (Platform-As-A-Service) offerings that Azure provides to deploy your Worker Role or Web Role into the cloud VM(s). So you can control the scalability, reliability, and cost anticipated for your application.  You can access your service remotely if you expose your Web Role endpoints. However, this post is about how you enable remote desktop access to your cloud service VM(s) secured manner.  There are two ways of enabling the Remote Desktop feature on your cloud service. - Azure Portal configuration (UI) - Cloud Definition and Configuration (code deployment) This is the link to enable RDP using the Azure Portal . Here in this post, we are more focused on how to enable RDP from the code. Pre-requisites: - Azure SDK - Azure Portal Access - Cloud Service Solution for testing  Steps: Open your cloud solution and locate the below files - ServiceConfiguration.cscfg  - ServiceDefinition.csdef In your ServiceDefinition file, you need to defi