How to load files from azure powershell to Azure Data Lake - azure

How to load .ps1 files from Azure Powershell to Azure data lake?
I have tried in my local machine (Powershell), there it is working fine.
while uploading it into the Azure Powershell, we are not able to fetch the exact location. And how do we create a file in Azure data lake using Azure Powershell?

If we want to create a file we could use Azure powershell command.
New-AzureRmDataLakeStoreItem -AccountName "AccountName" -Path "/NewFile.txt"
If we want to upload a local file to Azure data lake
Import-AzureRmDataLakeStoreItem -AccountName "ContosoADL" -Path "C:\SrcFile.csv" -Destination "/MyFiles/File.csv" -Concurrency 4
But before excute the command please make sure that you have permission to do that. How to assign the role to application or service principle, please refer to this tutorial.
For more Powershell command about data lake please refer to this document.

Related

How to export Adf pipelines,dataflows,datasets into Azure Synapse

I have 100 dataflows ,50 pipelines and their related datasets variables etc.
Now i want to use Synapse service and want my all pipelines amd stuff of ADF into Synapse. My Adf is git configured
Can we export them in one go??
To move data from data factory to synapse we need to download the supported module files in ADF.
I tried to migrate data from ADF to Synapse workspace using PowerShell following below procedure:
I connected to Azure account using below command:
Connect-AzAccount
I set my subscription using below command:
Select-AzSubscription -SubscriptionName "<SubscriptionName>"
I created a linked service for source and sink using below comand:
Set-AzSynapseLinkedService -WorkspaceName <synapseworkspace> -Name <linkedservicename> -DefinitionFile "<json file path>"
I created dataset for source and sink in synapse workspace using below command:
Set-AzSynapseDataset -WorkspaceName <synapseworkspace> -Name <datasetname> -DefinitionFile "<json file path>"
I created pipeline in synapse workspace using below command:
Set-AzSynapsePipeline -WorkspaceName <synapseworkspace> -Name <pipelinename> -DefinitionFile "<json file path>"
They are created successfully in synapse workspace:
In your case you are having bulk data in your data factory, you can use Azure Data Factory to Synapse Analytics Migration Tool.
You can migrate Azure Data Factory pipelines, datasets, linked service, integration runtime and triggers to a Synapse Workspace through below PowerShell script:
.\importADFtoSynapseTool.ps1 -sourceADFResourceId "/subscriptions/<SubscriptionID>/resourcegroups/<ADFResourceGroupName>/providers/Microsoft.DataFactory/factories/<ADFName>" -destSynapseResourceId "/subscriptions/<SubscriptionID>/resourcegroups/<SynapseResourceGroupName>/providers/Microsoft.Synapse/workspaces/<SynapseName>" -TenantId <tenantId>
Resource group name for Azure Data Factory
Resource group name for Azure Synapse Workspace
Subscription ID
Tenant ID (you can find this by click Azure Active Directory in the Azure Portal)
For more clarification you can visit this.
As far as I know, there is no way to do this out of the box.
There is an option to download the object's JSON and then use PowerShell to recreate the objects in Synapse workspace.
I haven't tried that myself, but the process is explained here.

How to use Jenkins to upload to Azure Data Lake Storage Gen1?

I found the Windows Azure Storage Plugin for Jenkins. But it seems that it works only with blob storage.
Is there a way to upload files to Azure Data Lake Storage Gen1 from Jenkins ?
Thanks for your help !
AFAIK currently there is no Jenkins plugin to upload files to Azure Data Lake Storae Gen1 from Jenkins.
You could use Azure PowerShell or Azure CLI to accomplish your requirement.
Sample Azure PowerShell command:
Import-AzDataLakeStoreItem -AccountName $dataLakeStorageGen1Name -Path "C:\sampledata\vehicle1_09142014.csv" -Destination $myrootdir\mynewdirectory\vehicle1_09142014.csv
Sample Azure CLI command:
az dls fs upload --account mydatalakestoragegen1 --source-path "C:\SampleData\AmbulanceData\vehicle1_09142014.csv" --destination-path "/mynewfolder/vehicle1_09142014.csv"
For more information, refer below articles:
https://learn.microsoft.com/en-us/azure/data-lake-store/data-lake-store-get-started-powershell#upload-data-to-your-data-lake-storage-gen1-account
https://learn.microsoft.com/en-us/azure/data-lake-store/data-lake-store-get-started-cli-2.0
https://learn.microsoft.com/en-us/powershell/module/az.datalakestore/import-azdatalakestoreitem?view=azps-1.5.0
https://learn.microsoft.com/en-us/cli/azure/dls/fs?view=azure-cli-latest#az-dls-fs-upload
Few pre-requisites to make this work without any issues are:
Have Azure PowerShell / Azure CLI installed in the node where you run the command(s).
Add Azure service principal to Jenkins credential as instructed here -> https://learn.microsoft.com/en-us/azure/jenkins/execute-cli-jenkins-pipeline#add-azure-service-principal-to-jenkins-credential
Hope this helps!! Cheers!!

Install Powershell for Azure without an Azure Account

I want to use Get-AzureStorageBlob in a powershell script so my client can download files from my Azure Blob storage ( I use Devops to put them there )
The keys are in the script so the client does not need an Azure account.
He does however need to install Azure Powershell
And the instructions ask him to log in to Azure.
Is there an alternative?
If you just operates with azure storage, then you can ignore the "Connect-AzAccount" cmdlet.
After installing azure powershell module, since you have account_name and account_key of storage account, directly use them to download the blob.
But if you want to operate other resources like vm etc.,then you need to the cmdlet "Connect-AzAccount".
When I click Show Details in the right Commands panel I get an error message
cannot be loaded because running scripts is disabled on this system.

Copy files from Azure Data Lake Store to Azure Storage with Azure Automation

I want copy my files from Data Lake Store to Azure Storage per using Azure Automation.
I find a Get-AzureStorageFile cmdlet but it required as parameter "Directory" that have a CloudFileDirectory type.
Thanks :-)
I believe you'll want to use the AzureRm.AzureDataLakeStore module.
Go to your Automation account and down to the "Modules" blade. Add module from the gallery.
Have a check in the runbook to make sure the module is loaded. Then perform upload or other Data Lake Store functions.
# Check if the AzureRM.DataLakeStore module is loaded
If ((Get-Module -Name AzureRM.DataLakeStore -ListAvailable).Count -le 0) {
Write-Log -Value "ERROR: The AzureRM.DataLakeStore module is not available, exiting script" -Color Red
Write-Log -Value "Please Update Modules or download the Azure PowerShell modules from https://azure.microsoft.com/en-us/downloads/" -Color Yellow
return
}
$myrootdir = "\"
Import-AzureRmDataLakeStoreItem -AccountName "myadls.azuredatalakestore.net -Path "C:\sampledata\vehicle1_09142014.csv" -Destination $myrootdir\mynewdirectory\vehicle1_09142014.csv
You can use AdlCopy to perform this. However, you need to configure a Hybrid Runbook Worker in your subscription and then install the AdlCopy. Then use the Azure Automation Runbook to run AdlCopy commands. (Select "Hybrid Worker" when you execute the runbook)
Use AdlCopy (as standalone) to copy data from another Data Lake Storage Gen1 account:
https://learn.microsoft.com/en-us/azure/data-lake-store/data-lake-store-copy-data-azure-storage-blob#use-adlcopy-as-standalone-to-copy-data-from-another-data-lake-storage-gen1-account
Configure Hybrid Runbook Worker:
https://learn.microsoft.com/en-us/azure/automation/automation-windows-hrw-install#automated-deployment

U-SQL Job Failing in Data Factory

I keep getting following error from Data Factory whenever I run an U-SQL Job
Job submission failed, the user 'adla account name' does not have permissions to a subfolder in the /system/ path needed by Data Lake Analytics. Please run “Add User Wizard” from the Data Lake Analytics Azure Portal or use Azure PowerShell to grant access for the user to the /system/ and its children on the Data Lake Store.
And I am not using any Firewall as suggested in this post:
Run U-SQL Script from C# code with Azure Data Factory
I am using the Azure Data Lake Store service principal authentication. When I start the Job from Visual Studio, it also works fine.
I would be grateful for any idea...
thanks
If you are authorising the Azure Data Lake Analytics linked service from Azure Data Factory with a service principal that could be your problem.
I have an outstanding support ticket with Microsoft because the service principal authentication method only works with simple data factory activities like 'copy'. It does not work if you want to authenticate complex activities like 'DotNotActivity'.
My advise would be to change the linked service back to using session and token auth, then deploy your activities and try again.
Hope this helps.
It does sound like a permissions problem. You can run this powershell script to ensure you have applied the proper permissions to the security principal:
Login-AzureRmAccount
$appname = “adla”
$dataLakeStoreName = “yourdatalakename”
$app = Get-AzureRmADApplication -DisplayName $appname
$servicePrincipal = Get-AzureRmADServicePrincipal -SearchString $appname
Set-AzureRmDataLakeStoreItemAclEntry -AccountName $dataLakeStoreName -Path / -AceType User -Id $servicePrincipal.Id -Permissions All
Set-AzureRmDataLakeStoreItemAclEntry -AccountName $dataLakeStoreName -Path /system -AceType User -Id $servicePrincipal.Id -Permissions All
If you want to create everything from scratch using a powershell script, here is a blog that will help you:
http://dyor.com/setting-up-an-azure-data-lake-and-azure-data-factory-using-powershell/

Resources