Monday, October 31, 2022

How to create Azure Sql Database and access it from dev machine?

 Description:

                                In software development, we knew how to create an SQL Database in local machines and how to access it, here we are going to see how to create an SQL Database from Azure then how to access it from development machines / laptop.

Prerequisite:

  • Knowledge of Ms Sql Server
  • Anyone browser
Below steps we are going to follow, here I'm going to use Edge browser but, if you wish you could use any browser

  1. Sign in on www.azure.com from the home page click Create a resource 







  2. In the next window, click Create under Sql Database 


  3. From the project details click Create new under Resource Group now a popup will appear there type the name as RG-SqlDb click Ok  

  4. Next, Under Database details, type the Database name as sqlDbDemoJ then click Create new under Server then a new page opens up there
    1. Server name as jsqldbserverdemo
    2. Location as West Europe (you can take any location)
    3. Authentication method as Use SQL Authentication
    4. Server Admin Login as adminj
    5. Password, confirm password as our wish then click Ok

  5. Want to use elastic pool as No 
  6. Workload environment as Development
  7. Click Configure Database under Compute + Storage, in the next screen choose Serverless from Compute tier 

  8. Hardware Configuration let it be Standard-series(Gen5)
  9. Data max size (GB) is 2 since it's our demo DB so, I have chosen less size
  10. The rest of the configs are let it be and click Apply  button
  11. From the main page click Review + create from the final page tab click Create
  12. Now, azure has started to validate our choices and create the resources, it will take less than one minute so, please wait, the beauty here is we could see the estimated cost on the right side 
  13. After successful creation we could see the page like below there click Go to resource button

  14. From the resource page, on search location type Connection there click on Connection String this will show the connection string details with multiple providers so, I choose Ado.Net 

  15. Now I want to connect this Db from my laptop so, so I use SSMS to connect but, it gives the below error 

  16. It's because now we know server data source, user id, and password but, in azure we are blocked to access this DB due to firewall settings so, go back to the azure portal there click Set server firewall 

  17. Under Public access click Selected networks then under Firewall rules click +Add your client ipv4 address then azure automatically takes your current IP and creates a rule like below, if we want then we can change the rule name then click Save

  18. Now again, from my laptop using SSMS I tried to connect the Azure Sql DB and I'm able to connect and I have created one table as well 

Conclusion:

so, that's it we achieved about how to create Azure Sql Db and access it from laptop. I hope this will be helpful for developers.
r
Now



How to create Azure Sql Database and access it from dev machine?

 Description:                                   In software development, we knew how to create an SQL Database in local machines and how to...