Sunday 30 May 2021

SQL Server: Remove SQL Express from Server Name

We will learn how we can convert named instances to default instances. We will connect the server without writing SQL Express. 


Step 1: Open SQL Server Configuration Manager. Search in the laptop for SQL Server Configuration and select as shown in the snapshot below.





















Step 2: Click SQL Server Network Configuration and Click Protocols for INSTANCENAME (i.e SQLEXPRESS)

















Step 3: Right Click TCP/IP and click Enabled

Step 4: Right-click TCP/IP and go to Properties, Click on  the IP Addresses tab and scroll down to the IP All section

Step 5: Clear the field TCP Dynamic Ports (i.e. empty/blank) and set TCP Port to 1433. Press Ok

















Step 6: Go to SQL Server Services and Right-click your SQL Server (INSTANCE NAME) and click Restart 













This will make the named instance listen on the default port. Now, you no need to write SQL Express in the Server Name.



Tuesday 4 May 2021

Create Azure Key Vault and Access in Asp.Net Core Application

Azure Key Vault is a cloud service that helps teams securely store connection string, passwords, etc, and access them. Today in the article we will learn how to create the Key Vault in Azure Portal and how to access secrets in our code. 


Step 1: Go to Azure Portal and search Key Vault and create it. 



 





Step 2: Enter Key Vault Name, Resource Group, Region, etc as mentioned the below screenshot.

Press Review + Create button. 


Step 3: It will check validation in the background and it will create a new Key Vault. 


Step 4: Click on Your Key Vault and go to Secrets and Press Generate/Import button.



 






Step 5: Create a new secret with any name. I have created a new secret dbpwd. Press Create button.



 







Till now, we have created the Key Vault in the Azure Portal and created the secret too. Let’s fetch this secret value in the Code. Let’s create a sample in Asp.Net Core API application and fetch the secret.


Create/Open Visual Studio Web/API application. In my example, I have created Asp.Net Core 3.1 Application.


 Step 1: Go to Program.cs, In line number 35, I have specified my Key Vault URL. You can specify your Key Vault URL. if you are not aware of your URL then go to Azure Portal and click on the Key Vault and see in the Overview Tab. You can find the URL.

 


Note: I have used default credentials in line 27. I have logged in to Visual studio with the same credentials as I'm logged in on the Azure portal.


Step 2: Go to Controller and fetch Key Vault Secret.













I have created a new endpoint, kV, and fetch the secret value.


Step 3: Run the API Project



 





You can see it fetched the secret value in the browser. This is all about this article. I hope you like it.





How to find the reason of HTTP Error 500.30 - ASP.NET Core app failed to start in Azure App Service

HTTP Error 500.30 - The ASP.NET Core app failed to start If your web app is throwing an error HTTP error 500.30 then how to find the root ca...