/// <summary> /// Create or update a data factory linkedService. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.DataFactories.ILinkedServiceOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The resource group name of the data factory. /// </param> /// <param name='dataFactoryName'> /// Required. The name of the data factory. /// </param> /// <param name='parameters'> /// Required. The parameters required to create or update a data /// factory linkedService. /// </param> /// <returns> /// The create or update data factory linkedService operation response. /// </returns> public static LinkedServiceCreateOrUpdateResponse BeginCreateOrUpdate(this ILinkedServiceOperations operations, string resourceGroupName, string dataFactoryName, LinkedServiceCreateOrUpdateParameters parameters) { return Task.Factory.StartNew((object s) => { return ((ILinkedServiceOperations)s).BeginCreateOrUpdateAsync(resourceGroupName, dataFactoryName, parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Create or update a data factory linkedService. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.DataFactories.ILinkedServiceOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The resource group name of the data factory. /// </param> /// <param name='dataFactoryName'> /// Required. The name of the data factory. /// </param> /// <param name='parameters'> /// Required. The parameters required to create or update a data /// factory linkedService. /// </param> /// <returns> /// The create or update data factory linkedService operation response. /// </returns> public static Task<LinkedServiceCreateOrUpdateResponse> BeginCreateOrUpdateAsync(this ILinkedServiceOperations operations, string resourceGroupName, string dataFactoryName, LinkedServiceCreateOrUpdateParameters parameters) { return operations.BeginCreateOrUpdateAsync(resourceGroupName, dataFactoryName, parameters, CancellationToken.None); }
private void CreateLinkedService_Storage(DataFactoryManagementClient client) { // Setup LinkedService Parameters var parameters = new LinkedServiceCreateOrUpdateParameters() { LinkedService = new LinkedService() { Name = "StorageLinkedService", Properties = new LinkedServiceProperties( new AzureStorageLinkedService() { ConnectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", Parameters.Tenant.SiteName, Parameters.Tenant.StoragePrimaryKey) }) } }; // Create LinkedService client.LinkedServices.CreateOrUpdateAsync(Parameters.Tenant.SiteName, Parameters.Tenant.SiteName, parameters).Wait(); }
private void CreateLinkedService_HdInsight(DataFactoryManagementClient client) { // Setup LinkedService Parameters var properties = new HDInsightOnDemandLinkedService() { ClusterSize = 4, TimeToLive = new TimeSpan(0, 4, 0, 0), Version = "3.1", LinkedServiceName = "StorageLinkedService" }; var parameters = new LinkedServiceCreateOrUpdateParameters() { LinkedService = new LinkedService() { Name = "HDInsightLinkedService", Properties = new LinkedServiceProperties(properties) } }; // Create LinkedService client.LinkedServices.CreateOrUpdateAsync(Parameters.Tenant.SiteName, Parameters.Tenant.SiteName, parameters).Wait(); }
private void CreateLinkedService_Sql(DataFactoryManagementClient client) { // Setup LinkedService Parameters var parameters = new LinkedServiceCreateOrUpdateParameters() { LinkedService = new LinkedService() { Name = "AzureSqlLinkedService", Properties = new LinkedServiceProperties( new AzureSqlDatabaseLinkedService() { ConnectionString = string.Format("Server=tcp:{0}.database.windows.net,1433;Database={1};User ID={2}@{0};Password={3};Trusted_Connection=False;Encrypt=True;Connection Timeout=30", Parameters.GetSiteName("primary"), Parameters.Tenant.DatabaseName, Parameters.Tenant.UserName, Parameters.Tenant.Password) }) } }; // Create LinkedService client.LinkedServices.CreateOrUpdateAsync(Parameters.Tenant.SiteName, Parameters.Tenant.SiteName, parameters).Wait(); }