PowerShell betiği-Azure-SSIS tümleştirme çalışma zamanını dağıtmaPowerShell script - deploy Azure-SSIS integration runtime

Bu örnek PowerShell betiği, Azure 'da SSIS paketlerinizi çalıştırabilirler bir Azure-SSIS tümleştirme çalışma zamanı oluşturur.This sample PowerShell script creates an Azure-SSIS integration runtime that can run your SSIS packages in Azure.

Not

Bu makale Azure Az PowerShell modülünü kullanacak şekilde güncelleştirilmiştir.This article has been updated to use the Azure Az PowerShell module. Az PowerShell modülü, Azure ile etkileşim kurmak için önerilen PowerShell modülüdür.The Az PowerShell module is the recommended PowerShell module for interacting with Azure. Az PowerShell modülünü kullanmaya başlamak için Azure PowerShell’i yükleyin.To get started with the Az PowerShell module, see Install Azure PowerShell. Az PowerShell modülüne nasıl geçeceğinizi öğrenmek için bkz. Azure PowerShell’i AzureRM’den Az’ye geçirme.To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.

Bu örnek Azure PowerShell gerektirir.This sample requires Azure PowerShell. Sürümü bulmak için Get-Module -ListAvailable Az komutunu çalıştırın.Run Get-Module -ListAvailable Az to find the version. Yüklemeniz veya yükseltmeniz gerekirse, bkz. Azure PowerShell Modülü yükleme.If you need to install or upgrade, see Install Azure PowerShell module.

Azure 'a bağlanmak için Connect-AzAccount cmdlet 'ini çalıştırın.Run the Connect-AzAccount cmdlet to connect to Azure.

Örnek betikSample script

# If your inputs contain PSH special characters, e.g. "$", please precede it with the escape character "`" like "`$". 
# Azure Data Factory v2 information
$SubscriptionName = "[your Azure subscription name]"
$ResourceGroupName = "[your Azure resource group name]"
$DataFactoryName = "[your data factory name]"
$DataFactoryLocation = "EastUS" # In Public Preview, only EastUS|EastUS2 are supported for now

# Azure-SSIS Integration Runtime info - This is Data Factory compute resource for running SSIS packages
$AzureSSISName = "[your Azure-SSIS Integration Runtime name]"
$AzureSSISDescription = "This is my Azure-SSIS Integration Runtime"
$AzureSSISLocation = "EastUS" # In Public Preview, only EastUS|NorthEurope are supported for now
$AzureSSISNodeSize = "Standard_A4_v2" # In Public Preview, only Standard_A4_v2|Standard_A8_v2|Standard_D1_v2|Standard_D2_v2|Standard_D3_v2|Standard_D4_v2 are supported for now
$AzureSSISNodeNumber = 2 # In Public Preview, only 1-10 nodes are supported for now
$AzureSSISMaxParallelExecutionsPerNode = 2 # In Public Preview, only 1-8 parallel executions per node are supported for now
$VnetId = "[your VNet resource ID or leave it empty]" # OPTIONAL: In Public Preview, only Classic VNet is supported for now
$SubnetName = "[your subnet name or leave it empty]" # OPTIONAL: In Public Preview, only Classic VNet is supported for now

# SSISDB info
$SSISDBServerEndpoint = "[your Azure SQL Database server name.database.windows.net or your Azure SQL Managed Instance server endpoint]"
$SSISDBServerAdminUserName = "[your server admin username]"
$SSISDBServerAdminPassword = "[your server admin password]"
$SSISDBPricingTier = "[your Azure SQL Database pricing tier, e.g. S3, or leave it empty for Azure SQL Managed Instance]" # Not applicable for Azure SQL Managed Instance

##### Validate your Azure SQL Database/Managed Instance server ##### 
$SSISDBConnectionString = "Data Source=" + $SSISDBServerEndpoint + ";User ID="+ $SSISDBServerAdminUserName +";Password="+ $SSISDBServerAdminPassword
$sqlConnection = New-Object System.Data.SqlClient.SqlConnection $SSISDBConnectionString;
Try
{
    $sqlConnection.Open();
}
Catch [System.Data.SqlClient.SqlException]
{
    Write-Warning "Cannot connect to your Azure SQL DB logical server/Azure SQL MI server, exception: $_"  ;
    Write-Warning "Please make sure the server you specified has already been created. Do you want to proceed? [Y/N]"
    $yn = Read-Host
    if(!($yn -ieq "Y"))
    {
        Return;
    } 
}

##### Login and and select your Azure subscription #####
Login-AzAccount
Select-AzSubscription -SubscriptionName $SubscriptionName

##### Automatically configure VNet permissions/settings for your Azure-SSIS Integration Runtime to join ##### 
# Register to Azure Batch resource provider
if(![string]::IsNullOrEmpty($VnetId) -and ![string]::IsNullOrEmpty($SubnetName))
{
    $BatchObjectId = (Get-AzADServicePrincipal -ServicePrincipalName "MicrosoftAzureBatch").Id
    Register-AzResourceProvider -ProviderNamespace Microsoft.Batch
    while(!(Get-AzResourceProvider -ProviderNamespace "Microsoft.Batch").RegistrationState.Contains("Registered"))
    {
    Start-Sleep -s 10
    }
    # Assign VM contributor role to Microsoft.Batch
    New-AzRoleAssignment -ObjectId $BatchObjectId -RoleDefinitionName "Classic Virtual Machine Contributor" -Scope $VnetId
}

##### Provision your Azure Data Factory  + Azure-SSIS Integration Runtime ##### 
New-AzResourceGroup -Location $DataFactoryLocation -Name $ResourceGroupName
Register-AzResourceProvider -ProviderNamespace Microsoft.DataFactory

$secpasswd = ConvertTo-SecureString $SSISDBServerAdminPassword -AsPlainText -Force
$serverCreds = New-Object System.Management.Automation.PSCredential($SSISDBServerAdminUserName, $secpasswd)

Set-AzDataFactory -ResourceGroupName $ResourceGroupName `
                         -Location $DataFactoryLocation `
                         -Name $DataFactoryName
Set-AzDataFactoryIntegrationRuntime  -ResourceGroupName $ResourceGroupName `
                                            -DataFactoryName $DataFactoryName `
                                            -Name $AzureSSISName `
                                            -Type Managed `
                                            -CatalogServerEndpoint $SSISDBServerEndpoint `
                                            -CatalogAdminCredential $serverCreds `
                                            -CatalogPricingTier $SSISDBPricingTier `
                                            -Description $AzureSSISDescription `
                                            -Location $AzureSSISLocation `
                                            -NodeSize $AzureSSISNodeSize `
                                            -NodeCount $AzureSSISNodeNumber `
                                            -MaxParallelExecutionsPerNode $AzureSSISMaxParallelExecutionsPerNode `
                                            -VnetId $VnetId `
                                            -Subnet $SubnetName
write-host("##### Starting #####")
Start-AzDataFactoryIntegrationRuntime -ResourceGroupName $ResourceGroupName `
                                             -DataFactoryName $DataFactoryName `
                                             -Name $AzureSSISName `
                                             -Force
write-host("##### Completed #####")
write-host("If any cmdlet is unsuccessful, please consider using -Debug option for diagnostics.")

##### Query/monitor your Azure-SSIS Integration Runtime #####
#Get-AzDataFactoryIntegrationRuntime -DataFactoryName $DataFactoryName -Name $AzureSSISName -ResourceGroupName $ResourceGroupName -Status

##### Reconfigure your Azure-SSIS Integration Runtime, e.g. stopping/scaling out to 5 nodes/starting #####
# Stopping your Azure-SSIS Integration Runtime will release its nodes and stop billing
#Stop-AzDataFactoryIntegrationRuntime -DataFactoryName $DataFactoryName -Name $AzureSSISName -ResourceGroupName $ResourceGroupName 

# Scaling out your Azure-SSIS Integration Runtime to 5 nodes
#Set-AzDataFactoryIntegrationRuntime -DataFactoryName $DataFactoryName -Name $AzureSSISName -ResourceGroupName $ResourceGroupName -NodeCount 5

# Starting your Azure-SSIS Integration Runtime will allocate its nodes and start billing
#Start-AzDataFactoryIntegrationRuntime -DataFactoryName $DataFactoryName -Name $AzureSSISName -ResourceGroupName $ResourceGroupName

##### Clean up ######
#Stop-AzDataFactoryIntegrationRuntime -DataFactoryName $DataFactoryName -Name $AzureSSISName -ResourceGroupName $ResourceGroupName -Force
#Remove-AzDataFactoryIntegrationRuntime -DataFactoryName $DataFactoryName -Name $AzureSSISName -ResourceGroupName $ResourceGroupName -Force
#Remove-AzDataFactory -Name $DataFactoryName -ResourceGroupName $ResourceGroupName -Force
#Remove-AzResourceGroup -Name $ResourceGroupName -Force

Dağıtımı temizlemeClean up deployment

Örnek betiği çalıştırdıktan sonra, kaynak grubunu ve onunla ilişkili tüm kaynakları kaldırmak için aşağıdaki komutu kullanabilirsiniz:After you run the sample script, you can use the following command to remove the resource group and all resources associated with it:

Remove-AzResourceGroup -ResourceGroupName $resourceGroupName

Veri fabrikasını kaynak grubundan kaldırmak için aşağıdaki komutu çalıştırın:To remove the data factory from the resource group, run the following command:

Remove-AzDataFactoryV2 -Name $dataFactoryName -ResourceGroupName $resourceGroupName

Betik açıklamasıScript explanation

Bu betik şu komutları kullanır:This script uses the following commands:

KomutCommand NotlarNotes
New-AzResourceGroupNew-AzResourceGroup Tüm kaynakların depolandığı bir kaynak grubu oluşturur.Creates a resource group in which all resources are stored.
Set-AzDataFactoryV2Set-AzDataFactoryV2 Veri fabrikası oluşturma.Create a data factory.
Set-AzDataFactoryV2IntegrationRuntimeSet-AzDataFactoryV2IntegrationRuntime Bulutta SSIS paketlerini çalıştırabilirler bir Azure-SSIS tümleştirme çalışma zamanı oluştururCreates an Azure-SSIS integration runtime that can run SSIS packages in the cloud
Start-AzDataFactoryV2IntegrationRuntimeStart-AzDataFactoryV2IntegrationRuntime Azure-SSIS tümleştirme çalışma zamanını başlatır.Starts the Azure-SSIS integration runtime.
Get-AzDataFactoryV2IntegrationRuntimeGet-AzDataFactoryV2IntegrationRuntime Azure-SSIS tümleştirme çalışma zamanı hakkında bilgi alır.Gets information about the Azure-SSIS integration runtime.
Remove-AzResourceGroupRemove-AzResourceGroup Bir kaynak grubunu tüm iç içe geçmiş kaynaklar dahil siler.Deletes a resource group including all nested resources.

Sonraki adımlarNext steps

Azure PowerShell hakkında daha fazla bilgi için bkz. Azure PowerShell belgeleri.For more information on the Azure PowerShell, see Azure PowerShell documentation.

Ek Azure Data Factory PowerShell betiği örnekleri Azure Data Factory PowerShell örneklerindebulunabilir.Additional Azure Data Factory PowerShell script samples can be found in the Azure Data Factory PowerShell samples.