編輯

共用方式為


Set-AzSqlServer

Modifies properties of a SQL Database server.

Syntax

Set-AzSqlServer
   [-ServerName] <String>
   [-SqlAdministratorPassword <SecureString>]
   [-Tags <Hashtable>]
   [-ServerVersion <String>]
   [-AssignIdentity]
   [-PublicNetworkAccess <String>]
   [-RestrictOutboundNetworkAccess <String>]
   [-MinimalTlsVersion <String>]
   [-PrimaryUserAssignedIdentityId <String>]
   [-KeyId <String>]
   [-FederatedClientId <Guid>]
   [-UserAssignedIdentityId <System.Collections.Generic.List`1[System.String]>]
   [-IdentityType <String>]
   [-Force]
   [-ResourceGroupName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-AzSqlServer cmdlet modifies properties of an Azure SQL Database server.

Examples

Example 1: Reset the administrator password

$SecureString = ConvertTo-SecureString -String "****" -AsPlainText -Force
Set-AzSqlServer -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -SqlAdministratorPassword $secureString

ResourceGroupName        : ResourceGroup01
ServerName               : Server01
Location                 : Australia East
SqlAdministratorLogin    : adminLogin
SqlAdministratorPassword :
ServerVersion            : 12.0
Tags                     :
Identity                 :
FullyQualifiedDomainName : server01.database.windows.net

This command resets the administrator password on the AzureSQL Server named server01.

Example 2

Modifies properties of a SQL Database server. (autogenerated)

Set-AzSqlServer -AssignIdentity -ResourceGroupName 'ResourceGroup01' -ServerName 'Server01'

Parameters

-AssignIdentity

Generate and assign a Microsoft Entra identity for this server for use with key management services like Azure KeyVault.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FederatedClientId

Specifies the Federated client ID of the server when using Cross-Tenant CMK, Do not set this value if you do not intent to use Cross-Tenant CMK

Type:Nullable<T>[Guid]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IdentityType

Type of identity to be assigned to the server. Possible values are SystemAsssigned, UserAssigned, 'SystemAssigned,UserAssigned' and None.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-KeyId

The Azure Key Vault URI that is used for encryption.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MinimalTlsVersion

The minimal TLS version to enforce for Sql Server

Type:String
Accepted values:None, 1.0, 1.1, 1.2
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PrimaryUserAssignedIdentityId

The primary User Managed Identity(UMI) id.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PublicNetworkAccess

Takes a flag, enabled/disabled, to specify whether public network access to server is allowed or not. When disabled, only connections made through Private Links can reach this server.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

Specifies the name of the resource group to which the server is assigned.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-RestrictOutboundNetworkAccess

When enabled, only outbound connections allowed by the outbound firewall rules will succeed.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ServerName

Specifies the name of the server that this cmdlet modifies.

Type:String
Aliases:Name
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ServerVersion

Specifies the version to which this cmdlet changes the server. The acceptable values for this parameter are: 2.0 and 12.0.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SqlAdministratorPassword

Specifies a new password, as a SecureString, for the database server administrator. To obtain a SecureString, use the Get-Credential cmdlet. For more information, type Get-Help ConvertTo-SecureString.

Type:SecureString
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tags

Specifies a dictionary of tags that this cmdlet associates with the server. Key-value pairs in the form of a hash table set as tags on the server. For example: @{key0="value0";key1=$null;key2="value2"}

Type:Hashtable
Aliases:Tag
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UserAssignedIdentityId

The list of user assigned identities.

Type:List<T>[String]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Outputs

AzureSqlServerModel