Introducción a Azure Data Lake Analytics mediante Azure PowerShellGet started with Azure Data Lake Analytics using Azure PowerShell
Aprenda a usar Azure PowerShell para crear cuentas de Azure Data Lake Analytics y luego enviar y ejecutar trabajos de U-SQL.Learn how to use Azure PowerShell to create Azure Data Lake Analytics accounts and then submit and run U-SQL jobs. Para obtener más información acerca de Análisis de Data Lake, consulte Información general sobre Análisis de Azure Data Lake.For more information about Data Lake Analytics, see Azure Data Lake Analytics overview.
PrerequisitesPrerequisites
Nota
Este artículo se ha actualizado para usar el nuevo módulo Az de Azure PowerShell.This article has been updated to use the new Azure PowerShell Az module. Aún puede usar el módulo de AzureRM que continuará recibiendo correcciones de errores hasta diciembre de 2020 como mínimo.You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. Para más información acerca del nuevo módulo Az y la compatibilidad con AzureRM, consulte Introducing the new Azure PowerShell Az module (Presentación del nuevo módulo Az de Azure PowerShell).To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. Para obtener instrucciones sobre la instalación del módulo Az, consulte Instalación de Azure PowerShell.For Az module installation instructions, see Install Azure PowerShell.
Antes de empezar este tutorial, debe tener la siguiente información:Before you begin this tutorial, you must have the following information:
- Una cuenta de Análisis de Azure Data Lake.An Azure Data Lake Analytics account. Consulte Introducción a Data Lake Analytics.See Get started with Data Lake Analytics.
- Una estación de trabajo con Azure PowerShell.A workstation with Azure PowerShell. Consulte Instalación y configuración de Azure PowerShell.See How to install and configure Azure PowerShell.
Inicio de sesión en AzureLog in to Azure
En este tutorial se asume que sabe usar Azure PowerShell.This tutorial assumes you are already familiar with using Azure PowerShell. En concreto, debe saber iniciar sesión en Azure.In particular, you need to know how to log in to Azure. Si necesita ayuda, consulte Get started with Azure PowerShell (Introducción a Azure PowerShell).See the Get started with Azure PowerShell if you need help.
Para iniciar sesión con un nombre de suscripción:To log in with a subscription name:
Connect-AzAccount -SubscriptionName "ContosoSubscription"
En lugar del nombre de la suscripción, también puede utilizar un identificador de suscripción para iniciar sesión:Instead of the subscription name, you can also use a subscription id to log in:
Connect-AzAccount -SubscriptionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Si se realiza correctamente, la salida de este comando es similar a la siguiente:If successful, the output of this command looks like the following text:
Environment : AzureCloud
Account : joe@contoso.com
TenantId : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
SubscriptionId : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
SubscriptionName : ContosoSubscription
CurrentStorageAccount :
Preparativos para el tutorialPreparing for the tutorial
Los fragmentos de código de PowerShell de este tutorial usan estas variables para almacenar esta información:The PowerShell snippets in this tutorial use these variables to store this information:
$rg = "<ResourceGroupName>"
$adls = "<DataLakeStoreAccountName>"
$adla = "<DataLakeAnalyticsAccountName>"
$location = "East US 2"
Información acerca de una cuenta de Data Lake AnalyticsGet information about a Data Lake Analytics account
Get-AdlAnalyticsAccount -ResourceGroupName $rg -Name $adla
Envío de un trabajo de U-SQLSubmit a U-SQL job
Cree una variable de PowerShell para almacenar el script U-SQL.Create a PowerShell variable to hold the U-SQL script.
$script = @"
@a =
SELECT * FROM
(VALUES
("Contoso", 1500.0),
("Woodgrove", 2700.0)
) AS
D( customer, amount );
OUTPUT @a
TO "/data.csv"
USING Outputters.Csv();
"@
Envíe el texto del script con el cmdlet Submit-AdlJob
y el parámetro -Script
.Submit the script text with the Submit-AdlJob
cmdlet and the -Script
parameter.
$job = Submit-AdlJob -Account $adla -Name "My Job" -Script $script
Como alternativa, puede enviar un archivo de script mediante el parámetro -ScriptPath
:As an alternative, you can submit a script file using the -ScriptPath
parameter:
$filename = "d:\test.usql"
$script | out-File $filename
$job = Submit-AdlJob -Account $adla -Name "My Job" -ScriptPath $filename
Obtenga el estado de un trabajo con Get-AdlJob
.Get the status of a job with Get-AdlJob
.
$job = Get-AdlJob -Account $adla -JobId $job.JobId
En lugar de llamar a Get-AdlJob una y otra vez hasta que finalice un trabajo, use el cmdlet Wait-AdlJob
.Instead of calling Get-AdlJob over and over until a job finishes, use the Wait-AdlJob
cmdlet.
Wait-AdlJob -Account $adla -JobId $job.JobId
Descargue el archivo de salida mediante Export-AdlStoreItem
.Download the output file using Export-AdlStoreItem
.
Export-AdlStoreItem -Account $adls -Path "/data.csv" -Destination "C:\data.csv"
Consulte tambiénSee also
- Para ver el mismo tutorial con otras herramientas, haga clic en los selectores de pestañas en la parte superior de la página.To see the same tutorial using other tools, click the tab selectors on the top of the page.
- Para obtener más información sobre U-SQL, consulte Introducción al lenguaje U-SQL de Análisis de Azure Data Lake.To learn U-SQL, see Get started with Azure Data Lake Analytics U-SQL language.
- Para conocer las tareas de administración, consulte Administración de Azure Data Lake Analytics mediante el Azure Portal.For management tasks, see Manage Azure Data Lake Analytics using Azure portal.