private async Task DeployCustomActivities()

in SamplesV1/ADFSecurePublish/AdfKeyVaultDeployment/AdfDeploy.cs [288:317]


        private async Task<bool> DeployCustomActivities(List<CustomActivityPackageInfo> packages, List<AdfFileInfo> allFiles, string outputFolder)
        {
            logger.Write(string.Empty);
            logger.Write("Deploying custom activity packages to blob storage", "Black");

            var tasks = new List<Task<bool>>();

            foreach (CustomActivityPackageInfo package in packages)
            {
                // Get connection string for blob account to upload to
                JObject jObject = allFiles.FirstOrDefault(x => x.Name == package.PackageLinkedService)?.JObject;

                var parts = package.PackageFile.Split('/');

                if (parts.Length != 2)
                {
                    throw new Exception("packageFile should have only one '/' in it. Current packageFile value: " + package.PackageFile);
                }

                string connectionString = jObject?.SelectToken("$.properties.typeProperties.connectionString").ToObject<string>();
                string localFilePath = Path.Combine(outputFolder, parts[1]);
                string blobFolder = parts[0];

                tasks.Add(blob.UploadFile(localFilePath, connectionString, blobFolder));
            }

            var packageUploadResults = await Task.WhenAll(tasks);

            return packageUploadResults.All(x => x);
        }