快速入门:创建服务器 - PowerShellQuickstart: Create a server - PowerShell

本快速入门介绍如何从命令行使用 PowerShell,以便在 Azure 订阅中创建 Azure Analysis Services 服务器。This quickstart describes using PowerShell from the command line to create an Azure Analysis Services server in your Azure subscription.

先决条件Prerequisites

Note

本文进行了更新,以便使用新的 Azure PowerShell Az 模块。This article has been updated to use the new Azure PowerShell Az module. 你仍然可以使用 AzureRM 模块,至少在 2020 年 12 月之前,它将继续接收 bug 修补程序。You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. 若要详细了解新的 Az 模块和 AzureRM 兼容性,请参阅新 Azure Powershell Az 模块简介To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. 有关 Az 模块安装说明,请参阅安装 Azure PowerShellFor Az module installation instructions, see Install Azure PowerShell.

  • Azure 订阅:访问 Azure 试用版来创建一个帐户。Azure subscription: Visit Azure Trial to create an account.
  • Azure Active Directory:订阅必须与 Azure Active Directory 租户相关联,且该目录中必须有一个帐户。Azure Active Directory: Your subscription must be associated with an Azure Active Directory tenant and you must have an account in that directory. 若要了解详细信息,请参阅身份验证和用户权限To learn more, see Authentication and user permissions.
  • Azure PowerShellAzure PowerShell. 要查找已安装的版本,请运行 Get-Module -ListAvailable AzTo find the installed version, run Get-Module -ListAvailable Az. 若要进行安装或升级,请参阅安装 Azure PowerShell 模块To install or upgrade, see Install Azure PowerShell module.

导入 Az.AnalysisServices 模块Import Az.AnalysisServices module

若要在订阅中创建一台服务器,请使用 Az.AnalysisServices 模块。To create a server in your subscription, you use the Az.AnalysisServices module. 将 Az.AnalysisServices 模块加载到 PowerShell 会话中。Load the Az.AnalysisServices module into your PowerShell session.

Import-Module Az.AnalysisServices

登录 AzureSign in to Azure

使用 Connect-AzAccount -Environment AzureChinaCloud 命令登录到 Azure 订阅。Sign in to your Azure subscription by using the Connect-AzAccount -Environment AzureChinaCloud command. 按屏幕说明操作。Follow the on-screen directions.

Connect-AzAccount -Environment AzureChinaCloud

创建资源组Create a resource group

Azure 资源组是在其中以组的形式部署和管理 Azure 资源的逻辑容器。An Azure resource group is a logical container where Azure resources are deployed and managed as a group. 创建服务器时,必须在订阅中指定资源组。When you create your server, you must specify a resource group in your subscription. 如果还没有资源组,可以使用 New-AzResourceGroup 命令新建一个。If you do not already have a resource group, you can create a new one by using the New-AzResourceGroup command. 以下示例在中国北部区域中创建名为 myResourceGroup 的资源组。The following example creates a resource group named myResourceGroup in the China North region.

New-AzResourceGroup -Name "myResourceGroup" -Location "ChinaNorth"

创建服务器Create a server

使用 New-AzAnalysisServicesServer 命令创建新的服务器。Create a new server by using the New-AzAnalysisServicesServer command. 以下示例在 ChinaNorth 区域的 myResourceGroup 中的 B0 层创建名为 myServer 的服务器,并指定 philipc@adventureworks.com 为服务器管理员。The following example creates a server named myServer in myResourceGroup, in the ChinaNorth region, at the B0 tier, and specifies philipc@adventureworks.com as a server administrator.

New-AzAnalysisServicesServer -ResourceGroupName "myResourceGroup" -Name "myserver" -Location ChinaNorth -Sku B0 -Administrator "philipc@adventure-works.com"

清理资源Clean up resources

可以使用 Remove-AzAnalysisServicesServer 命令从订阅中删除服务器。You can remove the server from your subscription by using the Remove-AzAnalysisServicesServer command. 若要继续完成本系列的其他快速入门和教程,请勿删除服务器。If you continue with other quickstarts and tutorials in this collection, do not remove your server. 以下示例删除在上一步创建的服务器。The following example removes the server created in the previous step.

Remove-AzAnalysisServicesServer -Name "myserver" -ResourceGroupName "myResourceGroup"

后续步骤Next steps

本快速入门介绍了如何使用 PowerShell 在 Azure 订阅中创建服务器。In this quickstart, you learned how to create a server in your Azure subscription by using PowerShell. 创建服务器后,可以通过配置(可选)的服务器防火墙对其进行保护。Now that you have server, you can help secure it by configuring an (optional) server firewall. 还可以直接从门户将基本示例数据模型添加到服务器。You can also add a basic sample data model to your server right from the portal. 拥有一个示例模型有助于了解如何配置模型数据库角色和测试客户端连接。Having a sample model is helpful when learning about configuring model database roles and testing client connections. 若要了解更多信息,请继续学习有关添加示例模型的教程。To learn more, continue to the tutorial for adding a sample model.