aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

aws rds监控慢sql

In this article, we will be exploring the process of enabling Windows authentication in AWS RDS SQL Server.

在本文中,我们将探讨在AWS RDS SQL Server中启用Windows身份验证的过程。

介绍 ( Introduction)

Microsoft SQL Server supports the following server authentication schemes:

Microsoft SQL Server支持以下服务器身份验证方案:

  • Windows Authentication mode: In this method, we use domain accounts to connect with SQL Server. The user account belongs to an active directory. It enforces an organization policy such as complex password, password expiry, account lockouts. Once SQL Server gets a request to connect using Windows authentication, it authenticates with the AD using SSPI. It is a recommended way of handling user authentication in SQL Server

    Windows身份验证模式:在这种方法中,我们使用域帐户与SQL Server连接。 该用户帐户属于一个活动目录。 它强制执行组织策略,例如复杂的密码,密码到期,帐户锁定。 SQL Server获得使用Windows身份验证进行连接的请求后,将使用SSPI与AD进行身份验证。 这是在SQL Server中处理用户身份验证的推荐方法
  • SQL Authentication: In this mode, SQL Server handles user authentication. We create SQL login, user, and provide appropriate right. It is not integrated with the organization’s Active directory

    SQL身份验证:在这种模式下,SQL Server处理用户身份验证。 我们创建SQL登录名,用户并提供适当的权限。 它未与组织的Active Directory集成

You can right-click on SQL instance, go to properties and view the server authentication modes.

您可以右键单击SQL实例,转到属性并查看服务器身份验证模式。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Amazon provides a managed database service RDS for SQL Server. It supports multiple several versions and editions of Microsoft SQL Server. You can go through the many useful articles related to AWS RDS SQL Server on SQLShack.

Amazon为SQL Server提供了托管数据库服务RDS。 它支持多个版本的Microsoft SQL Server。 您可以阅读许多与SQLShack上与AWS RDS SQL Server相关的有用文章。

Once we create the AWS RDS SQL Server, it enables SQL authentications. During database creation, it creates an admin account for SQL authentication, and you can log in with that user. Later, we can add multiple users with appropriate permissions.

创建AWS RDS SQL Server之后,它将启用SQL身份验证。 在数据库创建期间,它将创建一个用于SQL身份验证的管理员帐户,您可以使用该用户登录。 稍后,我们可以添加具有适当权限的多个用户。

I will cover the Windows authentication for AWS RDS SQL Server in the two articles.

在这两篇文章中,我将介绍AWS RDS SQL Server的Windows身份验证。

  1. In this first article, we will cover the following topics:

    • Configure an AWS Microsoft Active directory
    • Create an EC2 instance with Windows operation system and join it in the domain
    • Install Active Directory Administration tools on Windows Server 2019

    在第一篇文章中,我们将介绍以下主题:

    • 配置AWS Microsoft Active目录
    • 使用Windows操作系统创建EC2实例并将其加入域
    • 在Windows Server 2019上安装Active Directory管理工具

  2. In the second part, we will cover the following topics:

    • Create active directory users in the domain we created in this article
    • Add active directory domain in the RDS instance
    • Connect AWS RDS SQL Server using Windows authentication
    • Remove domain membership from AWS RDS SQL Server

    在第二部分中,我们将讨论以下主题:

    • 在我们在本文中创建的域中创建活动目录用户
    • 在RDS实例中添加活动目录域
    • 使用Windows身份验证连接AWS RDS SQL Server
    • 从AWS RDS SQL Server删除域成员身份

Let’s get started with the Windows authentication in the AWS RDS SQL Server.

让我们开始使用AWS RDS SQL Server中的Windows身份验证。

AWS RDS SQL Server中的Windows身份验证 (Windows authentication in AWS RDS SQL Server)

As you know, for a windows authentication, we require active directory users. SQL instance should be part of an active directory domain.

如您所知,对于Windows身份验证,我们需要活动目录用户。 SQL实例应该是活动目录域的一部分。

AWS RDS SQL Server supports mixed-mode authentication for SQL Server. We can use Windows authentication using the AWS managed Microsoft Active Directory service. You can also use your active organization directory, but to use it with RDS, you need to create a forest trust. For my demo instance, I do not have active directory configured, so we use the AWS Managed Microsoft AD for Windows authentication.

AWS RDS SQL Server支持SQL Server的混合模式身份验证。 我们可以通过AWS托管的Microsoft Active Directory服务使用Windows身份验证。 您也可以使用活动的组织目录,但要与RDS一起使用,则需要创建目录林信任。 对于我的演示实例,我没有配置活动目录,因此我们将AWS Managed Microsoft AD用于Windows身份验证。

配置AWS Microsoft Active目录 (Configure an AWS Microsoft Active directory)

To configure on active directory, navigate to Services ->Directory Service

要在活动目录上进行配置,请导航至“ 服务”->“目录服务”

It opens the following page that lists the existing Active directory in your accounts, if any.

它将打开以下页面,该页面列出了您帐户中现有的Active Directory(如果有)。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Click on Set up Directory, and you get the page to choose directory services. Select the option – AWS Managed Microsoft AD. We can connect this active directory with AWS resources that require a Microsoft active directory, such as AWS EC2, AWS RDS SQL Server, and AWS IT applications.

单击“ 设置目录”,您会看到选择页面服务的页面。 选择选项– AWS Managed Microsoft AD。 我们可以将此活动目录与需要Microsoft活动目录的AWS资源进行连接,例如AWS EC2,AWS RDS SQL Server和AWS IT应用程序。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

On the next page, we configure the active directory. It first asks for the edition we require for Microsoft Active Directory.

在下一页上,我们配置活动目录。 它首先要求提供Microsoft Active Directory所需的版本。

  • Edition: We can either use the Standard or Enterprise edition for Microsoft AD

    • Standard: It is suitable for small businesses and costs USD 0.1200 per hour. Standard edition is suitable for up to 30,000 objects
    • Enterprise: We can use it for a large business. It is optimized for 5,00,000 objects. It costs USD 0.4000 per hour

      aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

    版本 :我们可以将标准版或企业版用于Microsoft AD

    • 标准 :适用于小型企业,每小时收费0.1200美元。 标准版最多可容纳30,000个对象
    • 企业 :我们可以将其用于大型企业。 它针对5,00,000个对象进行了优化。 每小时收费USD 0.4000

  • Directory DNS Name: Specify a unique DNS ( Domain name service) for the directory. It should be a fully qualified name such as sqlshackdemo.com

    目录DNS名称:为目录指定唯一的DNS(域名服务)。 它应该是标准名称,例如sqlshackdemo.com
  • Admin Password: Specify the password for a default user Admin. We cannot use the word “admin” in the password. It is a case-sensitive password. You can perform the most common activities in the Active directory using this account

    • Create, update, remove the users, groups, and computers
    • Manage users and groups
    • Manage DNS configurations
    • View AD logs
    • View Security logs

    管理员密码:指定默认用户Admin的密码。 我们不能在密码中使用“ admin”一词。 区分大小写的密码。 您可以使用此帐户在Active Directory中执行最常见的活动

    • 创建,更新,删除用户,组和计算机
    • 管理用户和组
    • 管理DNS配置
    • 查看广告日志
    • 查看安全日志

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Click Next and select the VPC (Virtual Private Cloud) from the drop-down list. It is a virtual network for the AWS resources in your account. You can understand more about VPC in Amazon Docs.

单击“下一步”,然后从下拉列表中选择VPC(虚拟私有云)。 它是您账户中AWS资源的虚拟网络。 您可以在Amazon Docs中了解有关VPC的更多信息

If you have an existing VPC, select it from the drop-down, or we can create a new VPC using the option Create New VPC. I will go with the default VPC and subnets for this article.

如果您有现有的VPC,请从下拉列表中选择它,否则我们可以使用选项Create New VPC创建新的VPC。 我将使用本文的默认VPC和子网。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Review your Microsoft Active directory configurations and click on Create directory. You should also review the AD pricing and go back in case of any doubts.

查看您的Microsoft Active Directory配置,然后单击“ 创建目录”。 您还应该查看广告定价,如有任何疑问,请返回。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

It starts creating the active directory as per your requirement. It takes approximately 30 minutes to create and configure an active directory.

它开始根据您的要求创建活动目录。 创建和配置活动目录大约需要30分钟。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Once the AD configuration completes, its status changes to Active. You can see the directory ID and directory name in the following screenshot.

AD配置完成后,其状态将更改为Active 。 您可以在以下屏幕截图中看到目录ID和目录名称。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

创建Windows Server 2019 EC2实例 (Create a Windows Server 2019 EC2 instance)

We require an AWS EC2 instance with Windows operating system to connect with the AWS RDS SQL Server using SQL Server client tools. We should perform this step after the active directory status is Active.

我们需要具有Windows操作系统的AWS EC2实例,以使用SQL Server客户端工具与AWS RDS SQL Server连接。 在活动目录状态为Active之后,我们应该执行此步骤。

Navigate to Services -> EC2 and click on Launch Instance.

导航到服务-> EC2,然后单击启动实例。

In the first step, choose an Amazon Machine Image (AMI). For this demo, I am selecting the Microsoft Windows Server 2019 Base. You can select AMI as per your need.

第一步,选择一个Amazon Machine Image(AMI)。 对于此演示,我选择Microsoft Windows Server 2019 Base。 您可以根据需要选择AMI。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

In the next step, choose an instance type depending upon vCPU, Memory requirements. I choose t2.micro EC2 instance category that is eligible for a free-tier account as well.

在下一步中,根据vCPU,内存要求选择实例类型。 我还选择了也可以使用免费套餐帐户的t2.micro EC2实例类别。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Click on Next Configure Instance Details. It pre-fills the information for you, but you should verify the VPC. It should be the same VPC you selected in the directory services.

单击下一步配置实例详细信息。 它会为您预先填写信息,但是您应该验证VPC。 它应该是您在目录服务中选择的同一VPC。

In the Domain join directory, select the active directory we created earlier.

在“ 域加入目录”中 ,选择我们之前创建的活动目录。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

We also need to create an IAM role in the EC2 instance. Click on Create new IAM role. It opens a new browser tab and selects the EC2 role for AWS Systems Manager.

我们还需要在EC2实例中创建一个IAM角色。 单击创建新的IAM角色。 它会打开一个新的浏览器选项卡,并为AWS Systems Manager选择EC2角色

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Click on Next: Permissions, and it automatically attaches an AWS policy for you.

单击下一步:权限,它会自动为您附加一个AWS策略。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

In the next step, give a suitable name for this role and click on Create Role

在下一步中,为此角色指定一个合适的名称,然后单击“ 创建角色”

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

You get the following message once it created the role.

创建角色后,您会收到以下消息。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Now, go back to the EC2 instance configure tab and select the role we created above.

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

现在,返回到EC2实例的“配置”选项卡,然后选择我们上面创建的角色。

Review the storage requirement in the next step. We can go with the default values in this demo.

在下一步中查看存储要求。 我们可以在此演示中使用默认值。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Skip the next step tags. In the security group, allow the RDP connection for port 3389. For my demo instance, I allow users to connect with any IP address. You should restrict the IP range that should connect to EC2 instance in a production environment. If you allow connection from any IP, you get a warning message as well.

跳过下一步标签。 在安全组中,允许端口3389进行RDP连接。对于我的演示实例,我允许用户使用任何IP地址进行连接。 您应该限制生产环境中应连接到EC2实例的IP范围。 如果允许来自任何IP的连接,也会收到警告消息。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Review your EC2 configuration and click on Launch.

查看您的EC2配置,然后单击启动

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Click on Launch and select an existing key pair or create a new key pair to connect with the EC2 instance. You should save this key pair in a secure and safe location.

单击启动,然后选择现有的**对或创建新的**对以与EC2实例连接。 您应该将此**对保存在安全的位置。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Click on Launch instances. It creates an EC2 instance and joins it in the active directory domain we created earlier.

单击启动实例。 它创建一个EC2实例,并将其加入我们之前创建的活动目录域中。

EC2 instance status should be available along with 22 status checks completed.

EC2实例状态应该可用,同时完成22个状态检查。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Note-down the public DNS(IP4). Go to Run (shortcut key Windows + R) and type mstsc. It launches the Remote Desktop Connection window. Specify the public DNS of EC2 on the computer, as shown below.

记下公共DNS(IP4)。 转到“运行”(快捷键Windows + R),然后键入mstsc 。 它启动“远程桌面连接”窗口。 在计算机上指定EC2的公共DNS,如下所示。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Click on Connect and specify the credentials. We need to use the following credentials to connect with EC2 instance.

单击“连接”并指定凭据。 我们需要使用以下凭据来连接EC2实例。

  • User: sqlshackdemo\admin ( use the domain from the AWS managed directory and the admin account we created earlier)

    用户:sqlshackdemo \ admin(使用AWS托管目录中的域和我们之前创建的管理员帐户)
  • Password: Enter a password for the admin account

    aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

    密码:输入管理员帐户的密码

Click on Yes to accept the connection for this computer.

单击“ 是”接受此计算机的连接。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

It connects to the AWS EC2 instance with the [sqlshackdemo] domain that we created using the AWS managed AD service shown below.

它使用我们使用如下所示的AWS托管AD服务创建的[sqlshackdemo]域连接到AWS EC2实例。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

安装Active Directory管理工具 (Installing the Active Directory Administration Tools)

We require Active Directory administration tools to create users, groups in the [sqlshackdemo] active directory.

我们需要Active Directory管理工具在[sqlshackdemo]活动目录中创建用户和组。

Launch Server Manager in the EC2 instance. In the server manager, navigate to Manage -> Add roles and features wizard.

在EC2实例中启动服务器管理器。 在服务器管理器中,导航至管理->添加角色和功能向导。

You get the following wizard with a brief introduction. We can instance Windows roles, services, and features using this wizard.

您将获得以下向导并进行简要介绍。 我们可以使用此向导来实例化Windows角色,服务和功能。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Click on Next. We need to select Role-based or feature-based installation.

单击下一步。 我们需要选择基于角色或基于功能的安装

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

We do not need any change in the next screen. It automatically shows the EC2 instance in the server.

在下一个屏幕中,我们不需要任何更改。 它会自动显示服务器中的EC2实例。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

Skip the server roles and move to the next page for feature selection.

跳过服务器角色,然后移至下一页进行功能选择。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

In the feature selection, select the following.

在功能选择中,选择以下内容。

  • AD DS and AD LDS Tools under the Remote Server Administration Tools: It provides active directory services along with command-line tools to manage AD

    远程服务器管理工具下的AD DS和AD LDS工具 :它提供活动目录服务以及用于管理AD的命令行工具
  • DNS Server tools: It includes DNS command-line tools and snap-ins

    aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

    DNS服务器工具:它包括DNS命令行工具和管理单元

On the next page, confirm the feature we wish to install. Click on Install to confirm and begin installations.

在下一页上,确认我们要安装的功能。 单击安装以确认并开始安装。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

You get the following screen once all features are enabled.

启用所有功能后,将显示以下屏幕。

aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

结论 (Conclusion)

In this article, we learned to create the AWS managed active directory. We further created an AWS EC2 instance in the custom domain [sqlshackdemo]. I plan to cover the below topics in my next article, Advanced Windows Authentication configurations in AWS RDS SQL Server. So stay tuned.

在本文中,我们学习了如何创建AWS托管活动目录。 我们进一步在自定义域[sqlshackdemo]中创建了一个AWS EC2实例。 我计划在下一篇文章AWS RDS SQL Server中的高级Windows身份验证配置中涵盖以下主题。 因此,请继续关注。

  • Create active directory users and groups

    创建活动目录用户和组
  • Connect EC2 server with the active directory users

    将EC2服务器与活动目录用户连接
  • Configured an AWS RDS SQL Server for Windows authentication

    为Windows身份验证配置了AWS RDS SQL Server
  • Connect RDS using windows authentication

    使用Windows身份验证连接RDS

翻译自: https://www.sqlshack.com/initial-windows-authentication-configurations-in-aws-rds-sql-server/

aws rds监控慢sql