Programming is like any other sport. You might know the rules but you have to play to learn! – Zuckerberg
In this blogpost, we would see how to create New SQL Database in Azure through PowerShell way. We can do this way, to get benefit of source control processes as well as simple infrastructure as a code programming model, one another alternative instead of many UI clicks…
- Active Azure Subscription. If you don’t have, create a free account.
- Subscription Level Contributor access or Owner access. we can check our Access in Subscriptions–>Access Control (IAM)–>View my Access. (like below)
Create Azure SQL DB – PowerShell Way!
In Azure Portal, Click Cloud Shell icon, next to Global Search Resources Text Box.
Choose PowerShell option.
If No Storage Account is allocated there for Azure CLI yet, Choose the Subscription and Click Create Storage.
Then, the new Storage Account would be created with new Resource Group under selected subscription automatically. Once it gets successful and after connected terminal, below screen would come.
In the above code pic, we need to give our subscription id and can change our required location, unique name that helps appending random name with our resource group, server name and database name. we can also give our login as well as password, even firewall, kind of settings and options to create server as well as database etc.,
If you are interest to re-use the above code, visit AzureStuffs repos.
Just like above pic, we can simply copy and paste. once we understand and do code, we can re-use later whenever we want, even we can automate this as a flow also.
- The admin login name can’t be changed after it has been created.
- We can’t able to create an additional SQL login with full administrative permissions in SQL Database.
- If both startIP and endIP is equal to ‘0.0.0.0’, means ‘Allow Azure services and resources to access this server’ set to ‘Yes’.
If you are new/ non-tech persons or who loves to do the same in Portal/UI itself, Create New Azure SQL Database
If you are one who loves to do the same in Azure CLI(JSON) itself, Azure CLI way to Create New Azure SQL Database
To know more New-AzSqlServer related info, visit here.
To know more New-AzSqlDatabase related info, visit here.
- ADD and EDIT Client IP Address in Azure SQL DB
- T-SQL way to ADD and EDIT Client IP Address in Azure SQL DB
Kudos, We have successfully created our Azure SQL DB through PowerShell! Thus, we saw how to do PowerShell way to create New SQL Database and other settings and options.