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

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.

Related

Create Azure SQL Analytics via Powershell

I'm wondering if there is a specific Powershell command to create Azure SQL Analytics resource. So far I've only found how to enable sending diagnostics logs to a Log Analytics workspace.
I assume I can try arm template, but it will be nice if there is a dedicated command to avoid creating another json template.
You can use the following powershell:
Set-AzOperationalInsightsIntelligencePack -ResourceGroupName rgName -WorkspaceName workspaceName -IntelligencePackName AzureSQLAnalytics -Enabled $true
Reading: https://learn.microsoft.com/en-us/azure/azure-monitor/platform/powershell-workspace-configuration#create-and-configure-a-log-analytics-workspace

migrate sql server database to azure sql database

We have a sql server on vm, and a azure sql database, now we want to migrate/restore the vm db to the azure db. I know how to do that via ssms manually. But we want to schedule it because we need to run it daily. I can't find the t-sql scripts to do these. Is there any way?
You can use below PowerShell scripts with Azure Automation to schedule the creation of the bacpac and the import process to Azure SQL Database.
First you need to create a Blob storage account, then create a container on the storage account.
Set-AzureSubscription -CurrentStorageAccountName “YourStorageAccountName” -SubscriptionName $subscription
New-AzureStorageContainer -Name “mycontainer” -Permission Off
Now you need to create a bacpac using SqlPackage. You can schedule the creation of the bacpac using Schedule Tasks on Windows or using PowerShell.
SqlPackage /Action:Export /SourceServerName:SampleSQLServer.sample.net,1433 /SourceDatabaseName:SampleDatabase /TargetFile:"F:\Temp\SampleDatabase.bacpac"
Next upload the bacpac to the storage account using PowerShell.
Set-AzureStorageBlobContent -Container “mycontainer” -File “F:\Temp\SampleDatabase.bacpac”
Now you can import the bacpac to the Azure SQL Database logical server as a new database:
Get-AzureStorageKey –StorageAccountName “YourStorageAccountName”
$primarykey=(Get-AzureStorageKey -StorageAccountName “YourStorageAccountName”).Primary
$StorageUri=(Get-AzureStorageBlob -blob ‘SampleDatabase.bacpac’ -Container ‘mycontainer’).ICloudBlob.uri.AbsoluteUri
In addition to Import/Export you can use Snapshot Replication or Transactional Replication. See Replication to SQL Database single and pooled databases.
You can use SQL Data Sync, it will do several synchronizations per day, you configure the interval yourself.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-sync-data
Hybrid Data Synchronization: With Data Sync, you can keep data synchronized between your on-premises databases and Azure SQL databases to enable hybrid applications. This capability may appeal to customers who are considering moving to the cloud and would like to put some of their application in Azure.

How to load files from azure powershell to Azure Data Lake

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.

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