Today, we’ll create an Azure Synapse Analytics Workspace using PowerShell. You can include this script as part of your Azure DevOps pipelines and use it as Infrastructure as Code (IaC).
Creating services using the Azure Portal is an option. However, as you move towards more mature environments with service delivery and release practices, or strong CI/CD (continuous integration/continuous deployment) technologies, you don’t want to keep creating services manually.
The Azure PowerShell modules are great and you should take advantage of them. It’s also possible to use ARM (Azure Resource Manager) templates.
Table of Contents
Download the Script
The script is available through the following link:
Pre-requirements
Before you can run the script, download the Az Module and log into the Azure tenant.
Install Az Module
Install-Module -Name Az.Synapse
Connect to Azure
Connect-AzAccount
Execute Script
The script has the following parameters:
- ResourceGroupName
- Name
- Location
- Default Data Lake Storage Account
- Default Data Lake File System
- Admin SQL Login
- Admin SQL Password
- Default Tags (Not mandatory, switch)
- Tag Environment (Not mandatory)
- Tag Business Unit (Not mandatory)
The following command creates an Azure Synapse Analytics without the tags.
./Create-AzSynapseWorkspace -ResourceGroupName "rg-dataanalytics" -Name "synwsanalyticsps" -Location "Australia East" -DefaultDataLakeStorageAccountName "dlsstorageaccount" -DefaultDataLakeStorageFilesystem "dlsfs" -AdminSqlLogin "davidalzamendi" -AdminSqlPwd ""
The output will be similar to the following one.
The following command creates an Azure Synapse Analytics with the tags.
./Create-AzSynapseWorkspace -ResourceGroupName "rg-dataanalytics" -Name "synwsanalyticsps" -Location "Australia East" -DefaultDataLakeStorageAccountName "dlsstorageaccount" -DefaultDataLakeStorageFilesystem "dlsfs" -AdminSqlLogin "davidalzamendi" -AdminSqlPwd "" -DefaultTags -TagEnvironment "Test" -TagBusinessUnit "IT"
The service will be available for a final configuration, check this article to finalise the last steps.
Summary
In this post, you’ve seen how to easily create an Azure Synapse Analytics Workspace using PowerShell. The script allows you to include logic specific to your company.
Final Thoughts
I always suggest taking advantage of the Azure Portal to create services. Nevertheless, I believe that in a mature environment you want to expand on an Infrastructure as Code approach.
This allows you to bring code version control to your platform and easily integrate the scripts with CI/CD (continuous integration/continuous deployment) pipelines.
What’s Next?
In upcoming posts, I’ll continue to explore some of the great features and services available in the data analytics space within Azure services.