Set-AzSqlServer

In this Azure PowerShell article, we will discuss the syntax and usage of the Set-AzSqlServer PowerShell command with certain examples.

Set-AzSqlServer

This command can help you to update the properties of an Azure SQL Database server.

Syntax

Below is the syntax of the Set-AzSqlServer PowerShell command.

Set-AzSqlServer
 [-ServerName] <String> [-ResourceGroupName] <String>

Let’s discuss a few examples of the Set-AzSqlServer PowerShell command.

Example-1

You can execute the below PowerShell command to disable the PublicNetworkAccess property of the specified SQL server.

Set-AzSqlServer -ResourceGroupName 'Demo1234' -ServerName 'azurelessonssql' -PublicNetworkAccess Disabled

After executing the above command, I got the below output

ResourceGroupName             : Demo1234
ServerName                    : azurelessonssql
Location                      : eastus
SqlAdministratorLogin         : rajkishore
SqlAdministratorPassword      : 
ServerVersion                 : 12.0
Tags                          : {}
Identity                      : 
FullyQualifiedDomainName      : azurelessonssql.database.windows.net
ResourceId                    : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/Demo1234/providers/Microsoft.Sql/servers/azurelesson
                                ssql
MinimalTlsVersion             : 1.2
PublicNetworkAccess           : Disabled
RestrictOutboundNetworkAccess : Disabled
Administrators                : 
PrimaryUserAssignedIdentityId : 
KeyId                         : 
FederatedClientId             

You can check out the same output below

Set-AzSqlServer

Example-2

You can execute the below Azure PowerShell command to update the administrator password of the specified Azure SQL database server.

$myPswd = "Password@123456"
$myString = ConvertTo-SecureString $myPswd -AsPlainText -Force
Set-AzSqlServer -ResourceGroupName "Demo1234" -ServerName "azurelessonssql" -SqlAdministratorPassword $myString

After executing the above PowerShell script, I got the below expected output

Set-AzSqlServer PowerShell

You may also like following the below articles

Wrapping Up

In this Azure PowerShell article, we discussed the syntax and usage of the Set-AzSqlServer PowerShell command with certain examples. Thanks for reading this article !!!