使用 PowerShell 管理 Azure Analysis ServicesManage Azure Analysis Services with PowerShell

本文介绍用于执行 Azure Analysis Services 服务器和数据管理任务的 PowerShell cmdlet。This article describes PowerShell cmdlets used to perform Azure Analysis Services server and database management tasks.

服务器资源管理任务,如创建或删除服务器、暂停或恢复服务器操作,或使用 Azure Analysis Services cmdlet 更改服务级别(层级)。Server resource management tasks like creating or deleting a server, suspending or resuming server operations, or changing the service level (tier) use Azure Analysis Services cmdlets. 用于管理数据库的其他任务(如添加或删除角色成员、处理或分区)使用与 SQL Server Analysis Services 相同的 SqlServer 模块中包含的 cmdlet。Other tasks for managing databases like adding or removing role members, processing, or partitioning use cmdlets included in the same SqlServer module as SQL Server Analysis Services.

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.

权限Permissions

大多数 PowerShell 任务要求用户在所管理的 Analysis Services 服务器上具有管理员权限。Most PowerShell tasks require you have Admin privileges on the Analysis Services server you are managing. 已计划的 PowerShell 任务是无人参与操作。Scheduled PowerShell tasks are unattended operations. 运行计划程序的帐户或服务主体必须具有对 Analysis Services 服务器的管理权限。The account or service principal running the scheduler must have Admin privileges on the Analysis Services server.

对于使用 Azure PowerShell cmdlet 的服务器操作,你的帐户或运行计划程序的帐户还必须属于 Azure 基于角色的访问控制 (RBAC) 中资源的所有者角色。For server operations using Azure PowerShell cmdlets, your account or the account running scheduler must also belong to the Owner role for the resource in Azure Role-Based Access Control (RBAC).

资源和服务器操作Resource and server operations

安装模块 - Az.AnalysisServices Install module - Az.AnalysisServices
文档 - Az.AnalysisServices referenceDocumentation - Az.AnalysisServices reference

数据库操作Database operations

Azure Analysis Services 数据库操作使用与 SQL Server Analysis Services 相同的 SqlServer 模块。Azure Analysis Services database operations use the same SqlServer module as SQL Server Analysis Services. 但是,Azure Analysis Services 并非支持所有 cmdlet。However, not all cmdlets are supported for Azure Analysis Services.

SqlServer 模块提供任务特定的数据库管理 cmdlet,以及接受表格模型脚本语言 (TMSL) 查询或脚本的常规用途 Invoke-ASCmd cmdlet。The SqlServer module provides task-specific database management cmdlets as well as the general-purpose Invoke-ASCmd cmdlet that accepts a Tabular Model Scripting Language (TMSL) query or script. Azure Analysis Services 支持 SqlServer 模块中的以下 cmdlet。The following cmdlets in the SqlServer module are supported for Azure Analysis Services.

安装模块 - SqlServer Install module - SqlServer
文档 - SqlServer 参考Documentation - SqlServer reference

受支持的 cmdletSupported cmdlets

CmdletCmdlet 说明Description
Add-RoleMemberAdd-RoleMember 向数据库角色添加成员。Add a member to a database role.
Backup-ASDatabaseBackup-ASDatabase 备份 Analysis Services 数据库。Backup an Analysis Services database.
Remove-RoleMemberRemove-RoleMember 从数据库角色删除成员。Remove a member from a database role.
Invoke-ASCmdInvoke-ASCmd 执行 TMSL 脚本。Execute a TMSL script.
Invoke-ProcessASDatabaseInvoke-ProcessASDatabase 处理数据库。Process a database.
Invoke-ProcessPartitionInvoke-ProcessPartition 处理分区。Process a partition.
Invoke-ProcessTableInvoke-ProcessTable 处理表。Process a table.
Merge-PartitionMerge-Partition 合并分区。Merge a partition.
Restore-ASDatabaseRestore-ASDatabase 还原 Analysis Services 数据库。Restore an Analysis Services database.