- Lab
- Cloud
- Data

Provision an Azure SQL Managed Instance at the Command Line
This lab guides you through provisioning an Azure SQL Managed Instance using Azure CLI and PowerShell. You'll learn to configure networking, set up secure credentials, and monitor deployments through the command line. Designed for cloud engineers, it emphasizes automated, repeatable deployment over manual methods. By the end, you'll be equipped to deploy Azure SQL Managed Instances efficiently and reliably.

Path Info
Table of Contents
-
Challenge
Introduction and Setup
A common way of deploying and managing Azure SQL Managed Instance is through command line tools, such as Azure CLI and PowerShell.
The benefit of using command line tools is that it gives a maintainable way of handling automation and CI/CD deployments.
To run the scripts for these command line tools, you first need to install Azure CLI or PowerShell.
In this lab, you will write the scripts to deploy Azure SQL Managed Instance using two methods:
- Azure CLI
- PowerShell
info> Note: This environment does not have internet access so you don't need to run these installations. This lab will help you practice writing command line scripts.
If you get stuck on a task, you can check thesolutions
folder. -
Challenge
Setting Up Networking with Azure CLI
To deploy resources to Azure and make sure they are grouped together for better tracking and maintenance, you need to create them under a resource group. There are specific network resources that should be created first before deploying an Azure SQL Managed Instance successfully.
Network Resources
The network resources include:
- Virtual network
- Network security group
- Route table
- Subnet with delegations configured for managed instances service
-
Challenge
Deploying the Managed Instance Using Azure CLI
Now that the network requirements are ready, you can add the deployment script for Azure SQL Managed Instance.
You need to make sure that you link the Azure SQL Managed Instance with the virtual network and subnet.
-
Challenge
Repeating the Deployment with PowerShell
You can apply the same steps to deploy the Azure SQL Managed Instance using PowerShell scripts. PowerShell is mostly powerful for Windows platforms, but it also supports cross platform.
When using PowerShell, you can either install it locally or use Azure's cloud shell to be able to run a PowerShell script.
-
Challenge
Exploring Advanced Deployment Options
Extending the deployment with advanced configurations, such as securing access with private endpoints, configuring automated backups and policies, and organizing resources with tags for cost management, enhances the security and maintainability of your managed instance.
-
Challenge
Monitoring and Validation through Command Line
The command line tools also offer commands to be able to validate your resources and list the diagnostics for resource analysis. These are very important to log especially during automation like in CI/CD pipelines. ### Putting It All Together
Through this lab, you’ve successfully deployed an Azure SQL Managed Instance while incorporating advanced configurations to enhance security, reliability, and management. You’ve set up a Virtual Network with NSGs and Route Tables, created a dedicated subnet for a private endpoint securely linked to the Managed Instance, configured automated backups, and added resource tags for effective organization and cost management. By leveraging both Azure CLI and PowerShell, you’ve gained the flexibility to automate and replicate these deployments, ensuring scalability and adherence to best practices in real-world scenarios.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.