My Blog

Sharing programming insights since 2015. 160 articles (and counting!) filled with real-world experience and practical tips.

    How to pass parameters at registration time in Autofac

    Autofac is a powerful Inversion of Control (IoC) container for .NET applications that simplifies dependency injection (DI), and although it tends to be replaced by the .NET Core out-of-the-box DI, it is still in use in many web applications. You use Autofac to register concrete implementations to interfaces, so that at runtime these implementation are picked without the needing to use the new keyword.

    More complex registrations often require to pass a list of parameters to the constructor of the concrete class. Today we are going to see how to do that.

    Read the complete article

    How to solve the "Please remove the lock and try again error" in Azure

    When working with Azure, you might encounter the error message Error: The scope ... cannot perform delete operation because following scope(s) are locked: ... Please remove the lock and try again while attempting to delete a resource. This error typically occurs when a resource is locked by another operation, preventing its deletion. In our example we will try to delete a Subnet in a Virtual Network.

    Read the complete article

    Efficient Cost analysis based on Service type, my personal way to save on Azure

    Reducing operational costs on the Azure cloud is a task that is often overlooked. However, the Cost analysis service is designed to provide in-depth, easy-to-access insights into your cloud expenses.

    Especially when participating in projects for large companies you will not believe the amount of cash that can be saved on resources that nobody uses and forgot to delete.

    Read the complete article

    The ten most important features / terms of Microsoft Defender for Cloud on Azure

    In this article I would like to share with you my favorite ten most important terms of the Microsoft Defender for Cloud service. On Microsoft Defender, there are multiple overviews of security issues and navigating can be daunting, so to make the introduction easier to grasp, I use the following screenshot to mark the features on the UI and then explain each one of them in maximum of three sentences. Lets start.

    Read the complete article

    How to authenticate to Azure repositories and run Git commands in an Azure pipeline

    When working with Azure Pipelines, you may encounter a situation where you don’t know the repository name before the pipeline runs. In such cases, using the checkout: git://MyProject/MyRepo method won’t work, as variables can’t be used as values in that syntax.

    You will get the following error from Git:

    fatal: Cannot prompt because terminal prompts have been disabled.
    fatal: could not read Password for 'https://[email protected]/...': terminal prompts disabled
    

    To overcome this challenge, I came up with a solution: create a task at the beginning of your job definition that “authenticates” the pipeline against your Azure DevOps project.

    Let’s see this in action.

    Read the complete article