使用 PowerShell 脚本创建 SQL 个具有混合模式身份验证的 VM
Create SQL VM with Mixed Mode Authentication using PowerShell Script
我正在尝试使用无人值守的 PowerShell 脚本在 Azure 中创建一个 SQL Server 2016 Windows 2016 虚拟机,我是 运行,但是我找不到设置方法SQL 到 Mixed-Mode 使用 PowerShell 进行身份验证。
我可以安装 SQL 启动虚拟机,但我找不到任何命令来执行对 Mixed-Mode 身份验证的更改(即使使用 SQL Azure GUI 中的服务器配置 Blade)。
有没有人能提供一些关于如何设置的见解?
非常感谢
大卫
选项 1:使用 PowerShell 和模板
您可以通过创建模板直接从 Azure 门户获取命令。使用此程序:
- Select 新虚拟机名称:
SQL Server 2017 Enterprise Windows Server 2016
- 填写表格....在第 4 步
Configure SQL Server setting
中,您可以选择 select SQL Authentication
。 Select Enable
。
- 点击确定
- 在最后一步中,您可以选择单击
Create
或 Download template and parameters
。 Select第二个选项Download template and parameters
.
- 下载模板,里面有使用 PowerShell 和模板 JSON 文件的所有命令
Note! Don't forget to change the path to the template JSON if you want to execute it directly.
方案二:机器准备好后使用T-SQL
Note! you can execute the script using PowerShell as well, if you have permission.
使用管理员登录并执行:
USE [master]
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2
GO
我正在尝试使用无人值守的 PowerShell 脚本在 Azure 中创建一个 SQL Server 2016 Windows 2016 虚拟机,我是 运行,但是我找不到设置方法SQL 到 Mixed-Mode 使用 PowerShell 进行身份验证。
我可以安装 SQL 启动虚拟机,但我找不到任何命令来执行对 Mixed-Mode 身份验证的更改(即使使用 SQL Azure GUI 中的服务器配置 Blade)。
有没有人能提供一些关于如何设置的见解?
非常感谢 大卫
选项 1:使用 PowerShell 和模板
您可以通过创建模板直接从 Azure 门户获取命令。使用此程序:
- Select 新虚拟机名称:
SQL Server 2017 Enterprise Windows Server 2016
- 填写表格....在第 4 步
Configure SQL Server setting
中,您可以选择 selectSQL Authentication
。 SelectEnable
。 - 点击确定
- 在最后一步中,您可以选择单击
Create
或Download template and parameters
。 Select第二个选项Download template and parameters
. - 下载模板,里面有使用 PowerShell 和模板 JSON 文件的所有命令
Note! Don't forget to change the path to the template JSON if you want to execute it directly.
方案二:机器准备好后使用T-SQL
Note! you can execute the script using PowerShell as well, if you have permission.
使用管理员登录并执行:
USE [master]
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2
GO