使用 Azure 命令列介面 (CLI) 管理 Azure Data Lake AnalyticsManage Azure Data Lake Analytics using the Azure Command-line Interface (CLI)

了解如何使用 Azure CLI 管理 Azure Data Lake Analytics 帳戶、資料來源、使用者和工作。Learn how to manage Azure Data Lake Analytics accounts, data sources, users, and jobs using the Azure CLI. 若要使用其他工具查看管理主題,請按一下上方的索引標籤選取器。To see management topics using other tools, click the tab select above.

必要條件Prerequisites

開始進行本教學課程之前,您必須具備下列資源:Before you begin this tutorial, you must have the following resources:

  • Azure 訂用帳戶。An Azure subscription. 請參閱取得 Azure 免費試用See Get Azure free trial.

  • Azure CLI。Azure CLI. 請參閱 安裝和設定 Azure CLISee Install and configure Azure CLI.

    • 下載並安裝 Azure CLI 工具 發行前版本 ,才能完成這個示範。Download and install the pre-release Azure CLI tools in order to complete this demo.
  • 使用 az login 命令進行驗證,並且選取您想要使用的訂用帳戶。Authenticate by using the az login command and select the subscription that you want to use. 如需使用公司或學校帳戶驗證的詳細資訊,請參閱 從 Azure CLI 連線至 Azure 訂用帳戶For more information on authenticating using a work or school account, see Connect to an Azure subscription from the Azure CLI.

    az login
    az account set --subscription <subscription id>
    

    您現在可以存取 Data Lake Analytics 和 Data Lake Store 命令。You can now access the Data Lake Analytics and Data Lake Store commands. 執行下列命令以列出 Data Lake Store 和 Data Lake Analytics 命令:Run the following command to list the Data Lake Store and Data Lake Analytics commands:

    az dls -h
    az dla -h
    

管理帳戶Manage accounts

您必須擁有 Data Lake Analytics 帳戶,才能執行任何 Data Lake Analytics 工作。Before running any Data Lake Analytics jobs, you must have a Data Lake Analytics account. 與 Azure HDInsight 不同的是,分析帳戶未執行工作時,您無需支付該帳戶的費用。Unlike Azure HDInsight, you don't pay for an Analytics account when it is not running a job. 您只需支付執行工作時的費用。You only pay for the time when it is running a job. 如需詳細資訊,請參閱 Azure Data Lake Analytics 概觀For more information, see Azure Data Lake Analytics Overview.

建立帳戶Create accounts

執行下列命令來建立 Data Lake 帳戶。Run the following command to create a Data Lake account,

az dla account create --account "<Data Lake Analytics account name>" --location "<Location Name>" --resource-group "<Resource Group Name>" --default-data-lake-store "<Data Lake Store account name>"

更新帳戶Update accounts

下列命令會更新現有 Data Lake Analytics 帳戶的屬性The following command updates the properties of an existing Data Lake Analytics Account

az dla account update --account "<Data Lake Analytics Account Name>" --firewall-state "Enabled" --query-store-retention 7

列出帳戶List accounts

列出特定資源群組內的 Data Lake Analytics 帳戶List Data Lake Analytics accounts within a specific resource group

az dla account list "<Resource group name>"

取得帳戶的詳細資料Get details of an account

az dla account show --account "<Data Lake Analytics account name>" --resource-group "<Resource group name>"

刪除帳戶Delete an account

az dla account delete --account "<Data Lake Analytics account name>" --resource-group "<Resource group name>"

管理資料來源Manage data sources

Data Lake Analytics 目前支援以下兩個資料來源:Data Lake Analytics currently supports the following two data sources:

當您建立分析帳戶時,必須指定 Azure Data Lake 儲存體帳戶作為預設的儲存體帳戶。When you create an Analytics account, you must designate an Azure Data Lake Storage account to be the default storage account. 預設的 Data Lake 儲存體帳戶是用來儲存作業中繼資料與作業稽核記錄。The default Data Lake storage account is used to store job metadata and job audit logs. 建立分析帳戶後,就可以新增其他 Azure Data Lake 儲存體帳戶和/或 Azure 儲存體帳戶。After you have created an Analytics account, you can add additional Data Lake Storage accounts and/or Azure Storage account.

尋找預設的 Data Lake Store 帳戶Find the default Data Lake Store account

您可以執行 az dla account show 命令來檢視所使用的預設 Data Lake Store 帳戶。You can view the default Data Lake Store account used by running the az dla account show command. 預設帳戶名稱列在 defaultDataLakeStoreAccount 屬性底下。Default account name is listed under the defaultDataLakeStoreAccount property.

az dla account show --account "<Data Lake Analytics account name>"

新增其他 Blob 儲存體帳戶Add additional Blob storage accounts

az dla account blob-storage add --access-key "<Azure Storage Account Key>" --account "<Data Lake Analytics account name>" --storage-account-name "<Storage account name>"

注意

僅支援 Blob 儲存體簡短名稱。Only Blob storage short names are supported. 請勿使用 FQDN,例如 "myblob.blob.core.windows.net"。Don't use FQDN, for example "myblob.blob.core.windows.net".

新增其他的 Data Lake Store 帳戶Add additional Data Lake Store accounts

下列命令會使用其他 Data Lake Store 帳戶更新指定的 Data Lake Analytics 帳戶:The following command updates the specified Data Lake Analytics account with an additional Data Lake Store account:

az dla account data-lake-store add --account "<Data Lake Analytics account name>" --data-lake-store-account-name "<Data Lake Store account name>"

更新現有的資料來源Update existing data source

若要更新現有的 Blob 儲存體帳戶金鑰:To update an existing Blob storage account key:

az dla account blob-storage update --access-key "<New Blob Storage Account Key>" --account "<Data Lake Analytics account name>" --storage-account-name "<Data Lake Store account name>"

列出資料來源:List data sources:

若要列出 Data Lake Store 帳戶:To list the Data Lake Store accounts:

az dla account data-lake-store list --account "<Data Lake Analytics account name>"

若要列出 Blob 儲存體帳戶:To list the Blob storage account:

az dla account blob-storage list --account "<Data Lake Analytics account name>"

Data Lake Analytics 會列出資料來源

刪除資料來源:Delete data sources:

刪除 Data Lake Store 帳戶:To delete a Data Lake Store account:

az dla account data-lake-store delete --account "<Data Lake Analytics account name>" --data-lake-store-account-name "<Azure Data Lake Store account name>"

刪除 Blob 儲存體帳戶:To delete a Blob storage account:

az dla account blob-storage delete --account "<Data Lake Analytics account name>" --storage-account-name "<Data Lake Store account name>"

管理工作Manage jobs

您必須擁有 Data Lake Analytics 帳戶,才能建立工作。You must have a Data Lake Analytics account before you can create a job. 如需詳細資訊,請參閱 管理 Data Lake Analytics 帳戶For more information, see Manage Data Lake Analytics accounts.

列出工作List jobs

az dla job list --account "<Data Lake Analytics account name>"

Data Lake Analytics 會列出資料來源

取得工作詳細資料Get job details

az dla job show --account "<Data Lake Analytics account name>" --job-identity "<Job Id>"

提交工作Submit jobs

注意

工作的預設優先順序為 1000,工作的平行處理原則預設程度是 1。The default priority of a job is 1000, and the default degree of parallelism for a job is 1.

az dla job submit --account "<Data Lake Analytics account name>" --job-name "<Name of your job>" --script "<Script to submit>"

取消工作Cancel jobs

使用 list 命令來尋找工作識別碼,然後使用 cancel 來取消工作。Use the list command to find the job id, and then use cancel to cancel the job.

az dla job cancel --account "<Data Lake Analytics account name>" --job-identity "<Job Id>"

管線和週期Pipelines and recurrences

取得管線和週期的相關資訊Get information about pipelines and recurrences

使用 az dla job pipeline 命令來查看先前提交作業的管線資訊。Use the az dla job pipeline commands to see the pipeline information previously submitted jobs.

az dla job pipeline list --account "<Data Lake Analytics Account Name>"

az dla job pipeline show --account "<Data Lake Analytics Account Name>" --pipeline-identity "<Pipeline ID>"

使用 az dla job recurrence 命令來查看先前提交作業的週期資訊。Use the az dla job recurrence commands to see the recurrence information for previously submitted jobs.

az dla job recurrence list --account "<Data Lake Analytics Account Name>"

az dla job recurrence show --account "<Data Lake Analytics Account Name>" --recurrence-identity "<Recurrence ID>"

另請參閱See also