Build a Secure Integration Tests with Azure Key vaults in Azure DevOps

Scenario: We have an integration tests written in .NET and its using NUnit, We don’t want to store the API Key and all sensitive informations on the repository instead we want it to retrieve all the keys from azure key vaults. At the same time we also would like the Test Engineer to be able to run it on their local environment

One way to achieve it we can use Test parameters feature from NUnit

Add .runsettings in your project and this file will be used for local development/testing only and should not be checked in with the values, and the format can be something like below. If you want to know more details, you can check it here

<?xml version="1.0" encoding="utf-8" ?>
		<Parameter name="ApiKey" value="" />
		<Parameter name="RefreshToken" value="" />

Most importantly, you need to configure your IDE below

  1. Make sure autodetection of runsettings in enabled in Visual Studio by checking this checkbox: Tools > Options > Test > Auto Detect runsettings Files.
  2. Make sure you have created your runsettings file in the root of your solution, not your project root.
  3. If all else fails and your tests still can’t find your .runsettings file, you can specify the file manually in the Test Explorer by selecting Options > Configure Run Settings > Select solution wide Run Settings file.

For Visual Studio on Mac – you need to do below

Add the runsetting file path to the project file and it will do the work.

<Project Sdk=“Microsoft.NET.Sdk”>

In your test class, you can retrieve the test parameters through TestContext.Parameters

    public class MyTests
        private readonly string _apiKey;
        private readonly string _refreshToken;

        public async Task PopulateConfigs()
            _apiKey = TestContext.Parameters["ApiKey"];
            _refreshToken = TestContext.Parameters["RefreshToken"];


On the Azure Pipelines Yml file, this is how you retrieve it from the keyvaults and inject the TestRun Parameters as arguments

  vmImage: ubuntu-latest

trigger: none
pr: none
- cron: "0 20 * * Sun,Mon,Tue,Wed,Thu"
  displayName: Daily morning build
    - master
  always: true

  - name: dotnetVersion
    value: '7.0.x'

- stage:
  displayName: Run e2e .NET tests
  - job:
    displayName: build job
    - task: UseDotNet@2
      displayName: Use dotnet $(dotnetVersion)
        packageType: sdk
        version: $(dotnetVersion)
    - task: DotNetCoreCLI@2
      displayName: dotnet restore
        command: 'restore'
    - task: DotNetCoreCLI@2
      displayName: 'dotnet build'
        command: 'build'
    - task: AzureKeyVault@2
        azureSubscription: 'My Service Principal'
        KeyVaultName: 'my-keyvault-dev'
        SecretsFilter: '*'
        RunAsPreJob: false
    - task: DotNetCoreCLI@2
      displayName: 'dotnet test'
        command: 'test'
        arguments: '-- "TestRunParameters.Parameter(name=\"ApiKey\", value=\"$(ApiKey)\")" -- "TestRunParameters.Parameter(name=\"RefreshToken\", value=\"$(RefreshToken)\")"'

$(ApiKey) and $(RefreshToken) is mapped with your Azure Keyvault secrets name

How Fear Based Leaders Destroy Employee Morale and Performance

Fear is a powerful emotion that can motivate us to act or paralyze us from taking action. In the workplace, some leaders may use fear as a tool to influence their employees’ attitudes, values, or behaviors. However, this approach can have negative consequences for both the leaders and their teams. In this article, we will explore how fear-based leadership can destroy employee morale and performance, and what leaders can do instead to create a culture of psychological safety and empowerment.

I have learned of some instances where, upon receiving a resignation letter from an employee in my previous organization, the manager tried to dissuade them from leaving by saying “Don’t resign or else you will regret it” and citing examples of former employees who faced difficulties in their new jobs. I find this to be a very unprofessional and unethical tactic by the manager. A true leader would be supportive of their team member’s career aspirations and wish them well for their future endeavors. They would also recognize that the employee might have the potential to start their own successful business someday or be a successful leader.

What is fear-based leadership?

Fear-based leadership is a style of management that relies on threats, punishments, intimidation, or coercion to achieve desired outcomes. Fear-based leaders may use various tactics to instill fear in their employees, such as:

  • Setting unrealistic expectations and deadlines
  • Micromanaging and controlling every aspect of work
  • Criticizing and blaming employees for mistakes
  • Withholding praise and recognition
  • Creating a competitive and hostile work environment
  • Ignoring or dismissing employees’ opinions and feedback
  • Threatening employees with job loss, demotion, or pay cuts

Fear-based leaders may believe that fear is an effective motivator that can drive performance and productivity. They may also think that fear can help them maintain authority and control over their teams. However, research shows that fear-based leadership has many negative effects on both individuals and organizations.

The effects of fear-based leadership

Fear-based leadership can have detrimental impacts on employee morale and performance in various ways:

  • It demoralizes people: Fear-based leadership creates a power imbalance that erodes trust,
    respect, and dignity among employees. Employees may feel insecure, anxious, depressed,
    or hopeless about their work situation. They may also lose their sense of purpose and meaning in their work.
  • It creates a breeding ground for resentment: Some people may react with anger, frustration, or defiance to fear-based leadership. They may resent their leader for treating them unfairly or disrespectfully. They may also harbor negative feelings toward their colleagues who comply with or support the leader’s actions.
  • It impedes communication: Fear-based leadership discourages open and honest communication among employees.
    Employees may be afraid to speak up or share their ideas for fear of being ridiculed or punished by their leader. They may also avoid giving feedback or asking for help from their peers for fear of being seen as weak or incompetent. This leads to poor collaboration and information sharing within teams.
  • It inhibits innovation: Fear-based leadership stifles creativity and learning among employees. Employees may be reluctant to try new things or experiment with different solutions for fear of making mistakes or failing. They may also resist change or feedback for fear of losing their status quo or comfort zone. This hinders innovation and improvement within organizations.
  • It reduces engagement: Fear-based leadership lowers employee engagement levels. Employees may feel detached from their work goals and outcomes. They may also feel less motivated to perform well or go beyond expectations. They may only do the minimum required work to avoid negative consequences from their leader. This affects productivity and quality within organizations.

What leaders can do instead

Instead of using fear as a motivational tool for employees, leaders should create a culture of psychological safety
and empowerment within organizations. Psychological safety is “a shared belief held by members of a team that the team is safe for interpersonal risk taking”.

It means that employees feel comfortable expressing themselves without fearing negative repercussions from others.

Empowerment is “the process of enhancing feelings of self-efficacy among organizational members through identification with organizational goals”. It means that employees feel confident in their abilities and have autonomy over their work decisions.

Leaders who foster psychological safety and empowerment among employees can benefit from:

  • Higher trust: Employees trust their leaders who treat them with respect, care, and fairness.
    They also trust each other who support them, listen to them, and collaborate with them. Trust enhances teamwork,
    cooperation, and loyalty within organizations.
  • Higher morale: Employees feel valued, appreciated, and recognized by their leaders who praise them, reward them,

Power Apps – Mount a SQL Server table as an entity in Dataverse

Business Case: We have a need where we have an existing database from a legacy app and we really enjoyed how easy and fast it is to use Power Apps (Model Driven app) to access entities in dataverse. So can we use mount an external table to Dataverse and the answer is yes, it is possible and it is straight forward

Add a SQL Server Connection in Power Apps – “Authentication Type : SQL Server Authentication” for this POC. But I think the best practice is to use Service Principal (Azure AD Application)

On your SQL Server side (in my case i am using Azure), you need to whitelist the Power Platform IP Addresses – You can get the list of IP Addresses from here – Managed connectors outbound IP addresses

On the Power Apps – Go to Tables and Select New Table then select “New table from external data

Select the connection – SQL Server that we created before and then select the SQL Server table that you want to mount

Once all done, now you can see all the records in SQL server as virtual entity in your dataverse