azure虚拟机部署iis
In one of my articles about Microsoft Azure, I show how to create credentials and how to connect to an Azure Database using SQL Server Management Studio (SSMS). In this new article, we will talk about the Azure Virtual Machines and we will learn how to connect to them using our local SSMS. You will require unblocking ports, add endpoints and other tasks that I will explain later. We will also learn how to export a local database to an Azure Virtual Machine with SQL Server installed.
在我的有关Microsoft Azure的文章中 ,我展示了如何创建凭据以及如何使用SQL Server Management Studio(SSMS)连接到Azure数据库。 在这篇新文章中,我们将讨论Azure虚拟机,并将学习如何使用本地SSMS连接到它们。 您将需要取消阻塞端口,添加端点和其他任务,我将在后面解释。 我们还将学习如何将本地数据库导出到安装了SQL Server的Azure虚拟机。
In this example, we will require an Azure Virtual Machine installed, a local machine with SQL Server and SSMS installed, the Cloud Adapter (we are including the steps to configure it) and a certificate which will also be explained in this section.
在此示例中,我们将需要安装Azure虚拟机,安装了SQL Server和SSMS的本地计算机,云适配器(我们包括配置它的步骤)和证书,本节还将对此进行说明。
A local machine with the SQL Server Engine Installed and a database to export with access to internet.
The Cloud Adapter
A Cloud Adapter. The cloud adapter is an Azure Service required for SQL Server and generates a SSL certificate In the Azure portal. In order to create it, go to Virtual Machines and click on the virtual machine name.
Click on EndPoints.
Figure r2. The Endpoints
Add the Endpoint name, protocol and port (by default it is the port 11435).
Figure r4. The cloud Adapter for SQL
A certificate
Another requirement is a certificate to connect to the Cloud. In order to do it do the following steps:
Open the certmgr.msc. You can create your certificate or use an existing one. In this example we will use an existing one.
Select the certificate right click and select All Tasks>Export
The wizard to export certificates will be displayed. Click next.
Select if you want to have a private key.
R8. Private key question
Specify the format of the certificate.
Specify a name and a path.
R10. Selecting name and path of the .cer file.
Once the Wizard is completed, press finish.
Go to the Azure portal and click on the Virtual Machine.
R12. The virtual machine.
Click on the Management Certificates link.
R13. The certificates
Click the Upload button and upload the certificate created on step 7.
R14. The option to upload certificates.
To connect to a Virtual Machine, you can use the SQL Server Account. In order to enable the SQL Server authentication, in the Azure Virtual Machine (VM), open the SSMS and connect to the database. Right click on your Server and select properties. Change the Server Authentication to SQL Server and Windows Authentication to connect from your local machine.
Figure 1. Server properties
You will be prompted a message about restarting the SQL Server Service.
Figure 2. Information message.
Restart the Service in order for the new configuration to take effect.
Now that the SQL Server authentication is enabled, create a SQL Server Login.
Figure 4. Creating a new login.
Specify the login name and passwords. It is recommended to enforce the password policy for security reasons. In this example, we will omit the Enforce password policy to simplify the example.
Go to the Virtual Machine in the Azure Portal and click on the Virtual Machine name.
Figure 6. The virtual machine status
Click the ENDPOINTS link and press the Add icon to add a new Endpoint.
Figure 7. Endpoints
Select the add Standalone Endpoint
Figure 8. Adding endpoint
Write the name of the Endpoint. The protocol should be TCP and the port by default in the default instance is 1433.
The ACL allows you to specify the range of subnets allowed to access to your Azure virtual Machine. You can provide the name and subnet. If you do not your Internet IP, you can use this link.
Figure 10. The ACL details
You also need to enable the ports used to access remotely. Go to the Windows Firewall and right click on the Inbound Rules and select new rule.
Specify the port to which you want to apply a rule. In this case, it is the port 1433.
Figure 12. The TCP IP SQL Server port
In the action, select the allow the connection option.
Select the rule that you want to apply.
Figure 14. Rules to apply
Write a name for the rule.
Now connect to your Azure VM from the SSMS of the local machine.
Figure 16. Connect to an Azure VM from the local SSMSIf everything is OK you can now connect to the SQL Server machine with Azure from your local machine.
Now we will export our local database to the Azure Vm.
In the local SSMS, Select the database that you want to copy and select Tasks>Deploy Database to Windows Azure.
The Introduction Wizard Windows will be displayed.
Figure 18. The Introduction Wizard.
Press the Connect button to connect to the local SQL Server.
Specify the Server name and credentials and press Connect.
Figure 20. The local machine credentials.
Select a database to export and a temporary location for the backup files. Make sure that the SQL Server has permissions on a temporary location.
To connect to Azure, you will need a Certificate. You can also work with a publishing profile. For more information about a publishing profile.
Figure 22. Certificate.
Press the Select button and select the certificate created on the requirements section of this article. Copy the subscription ID of step 9 of the requirements in the certificate section.
Specify the Cloud Service name, Virtual Machine name and Storage Account and then press Settings.
Figure 24. The subscription ID.
Specify the Virtual Machine, your credentials and the Cloud Adapter port. Verify in the requirements the port used. By default, it is the port 11435.
You will receive a message about the certificate. If you agree, press Trust Publisher and connect.
Figure 26. The Trust message.
Finally you will have your information like this:
If everything is OK, the summary window will be displayed.
Figure 28. Summary Window
Finally, you will receive the results windows that will be green if everything is OK.
Figure 29. The Results wizard.To verify that the database was copied successfully, go to the virtual machine and verify that the database was copied successfully.
In this tutorial, we’ve learned how to connect to an Azure virtual machine with SQL Server using our local SQL Server. We also learned how to export a local database to a SQL Server Azure VM.
安装了SQL Server引擎的本地计算机和要访问Internet的要导出的数据库。
云适配器
云适配器。 云适配器是SQL Server必需的Azure服务,并在Azure门户中生成SSL证书。 为了创建它,请去虚拟机并且点击虚拟机名称。
单击端点。
图r2。 终点
添加端点名称,协议和端口(默认情况下为端口11435)。
图r4。 适用于SQL的云适配器
证书
另一个要求是连接到云的证书。 为此,请执行以下步骤:
打开certmgr.msc。 您可以创建证书或使用现有证书 。 在此示例中,我们将使用现有示例。
右键单击证书,然后选择“所有任务”>“导出”
将显示导出证书的向导。 点击下一步。
选择是否要使用私钥。
R8。 私人 关键 问题
指定证书的格式。
指定名称和路径。
R10。 选择名称和路径 。 cer 文件。
向导完成后,按完成。
转到Azure门户,然后单击“虚拟机”。
R12。 虚拟机。
单击管理证书链接。
R13。 证书
单击上载按钮,然后上载在步骤7中创建的证书。
R14。 上传证书的选项。
要连接到虚拟机,您可以使用SQL Server帐户。 为了启用SQL Server身份验证,请在Azure虚拟机(VM)中,打开SSMS并连接到数据库。 右键单击服务器,然后选择属性。 将服务器身份验证更改为SQL Server和Windows身份验证以从本地计算机连接。
图1. 服务器属性
系统将提示您有关重新启动SQL Server服务的消息。
图2. 信息消息。
重新启动服务,以使新配置生效。
现在已启用SQL Server身份验证,请创建一个SQL Server登录名。
图4.创建一个新的登录名。
指定登录名和密码。 出于安全原因,建议强制执行密码策略。 在此示例中,我们将省略“强制密码”策略以简化示例。
转到Azure门户中的虚拟机,然后单击虚拟机名称。
图6.虚拟机状态
单击ENDPOINTS链接,然后按添加图标以添加新的端点。
图7.端点
选择添加独立端点
图8. 添加端点
输入端点的名称。 该协议应为TCP,默认实例中的默认端口为1433。
ACL允许您指定允许访问Azure虚拟机的子网范围。 您可以提供名称和子网。 如果您没有Internet IP,则可以使用此链接 。
图10. ACL详细信息
您还需要启用用于远程访问的端口。 转到Windows防火墙,然后右键单击“入站规则”,然后选择新规则。
指定要对其应用规则的端口。 在这种情况下,它是端口1433。
图12. TCP IP SQL Server端口
在操作中,选择“允许连接”选项。
选择您要应用的规则。
图14. 适用规则
为规则写一个名字。
现在,从本地计算机的SSMS连接到您的Azure VM。
图16. 从本地SSMS连接到Azure VM如果一切正常,您现在可以从本地计算机使用Azure连接到SQL Server计算机。
现在,我们将本地数据库导出到Azure Vm。
在本地SSMS中,选择要复制的数据库,然后选择“任务”>“将数据库部署到Windows Azure”。
将显示“简介向导”窗口。
图18.简介向导。
按“连接”按钮连接到本地SQL Server。
指定服务器名称和凭据,然后按连接。
图20.本地计算机凭据。
选择要导出的数据库和备份文件的临时位置。 确保SQL Server对临时位置具有权限。
若要连接到Azure,您将需要一个证书。 您也可以使用发布配置文件。 有关发布配置文件的更多信息。
图22 。 证书。
按“选择”按钮,然后选择在本文的“需求”部分上创建的证书。 在证书部分中复制需求的步骤9的订阅ID。
指定云服务名称,虚拟机名称和存储帐户,然后按设置。
图2 4 。 订阅ID。
指定虚拟机,您的凭据和云适配器端口。 在要求中验证使用的端口。 默认情况下,它是端口11435。
您将收到有关证书的消息。 如果您同意,请按Trust Publisher并进行连接。
图26.信任消息。
最后,您将获得如下信息:
如果一切正常,将显示“摘要”窗口。
图28.摘要窗口
最后,如果一切正常,您将收到绿色的结果窗口。
图29.结果向导。
要验证数据库是否已成功复制,请转到虚拟机并验证数据库是否已成功复制。
在本教程中,我们学习了如何使用本地SQL Server通过SQL Server连接到Azure虚拟机。 我们还学习了如何将本地数据库导出到SQL Server Azure VM。
翻译自: https://www.sqlshack.com/migrate-your-database-to-an-azure-virtual-machine/
azure虚拟机部署iis