public static void CopyTestData(string srcContainer, string srcBlob, string destContainer, string destBlob = null) { ServiceManagementCmdletTestHelper vmPowershellCmdlets = new ServiceManagementCmdletTestHelper(); Process currentProcess = Process.GetCurrentProcess(); StringDictionary environment = currentProcess.StartInfo.EnvironmentVariables; string storageAccount = environment[CredentialHelper.StorageAccountVariable]; string storageAccountKey = environment[CredentialHelper.StorageAccountKeyVariable]; // Create a container try { vmPowershellCmdlets.RunPSScript(String.Format("{0}-{1} -Name {2}", VerbsCommon.Get, "AzureStorageContainer", destContainer)); } catch { // Create a container. vmPowershellCmdlets.RunPSScript(String.Format("{0}-{1} -Name {2}", VerbsCommon.New, "AzureStorageContainer", destContainer)); } // Make SAS Uri for the source blob. string srcSasUri = Utilities.GenerateSasUri(CredentialHelper.CredentialBlobUriFormat, storageAccount, storageAccountKey, srcContainer, srcBlob); if (string.IsNullOrEmpty(destBlob)) { vmPowershellCmdlets.RunPSScript(string.Format("{0}-{1} -SrcContainer {2} -SrcBlob {3} -DestContainer {4} -Force", VerbsLifecycle.Start, "AzureStorageBlobCopy", srcContainer, srcBlob, destContainer)); destBlob = srcBlob; } else { vmPowershellCmdlets.RunPSScript(string.Format("{0}-{1} -SrcUri \"{2}\" -DestContainer {3} -DestBlob {4} -Force", VerbsLifecycle.Start, "AzureStorageBlobCopy", srcSasUri, destContainer, destBlob)); } for (int i = 0; i < 60; i++) { var result = vmPowershellCmdlets.CheckCopyBlobStatus(destContainer, destBlob); if (result.Status.ToString().Equals("Success")) { break; } else { System.Threading.Thread.Sleep(10 * 1000); } } }