diff --git a/AzurePowershell.Test.targets b/AzurePowershell.Test.targets index 87301864f6dc..7add59e1ae07 100644 --- a/AzurePowershell.Test.targets +++ b/AzurePowershell.Test.targets @@ -22,6 +22,7 @@ .\src\ServiceManagement\HDInsight\Commands.HDInsight.Test\bin\Debug\Microsoft.WindowsAzure.Commands.HDInsight.Test.dll .\src\ServiceManagement\Storage\Commands.Storage.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Storage.Test.dll "!Functional&!Scenario&!AzureRTScenario&!Sequential&!PIRTest&!Preview&!ADDomain&!Network&!AzureRTUpload" + .\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll All "OneSDK&CIT" "Functional|AzureRTScenario|Sequential|AzureRTUpload|Network" @@ -187,6 +188,14 @@ ContinueOnError="false" /> + + + + + + diff --git a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj index 89eb2b979a81..9a62b1516884 100644 --- a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj +++ b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj @@ -70,12 +70,15 @@ ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -132,6 +135,7 @@ ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj index 3215eca634f9..a236d30bc15a 100644 --- a/src/Common/Commands.Common/Commands.Common.csproj +++ b/src/Common/Commands.Common/Commands.Common.csproj @@ -72,12 +72,15 @@ ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -132,6 +135,7 @@ ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj index 42c215032c01..ac2573d06b84 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj @@ -69,6 +69,15 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + True + + + True + + + True + ..\..\..\packages\Microsoft.DataFactories.Runtime.0.11.1-preview\lib\net45\Microsoft.DataFactories.Runtime.dll @@ -122,6 +131,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config index b8e25f318f05..7d2c20bbc9c1 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config @@ -9,6 +9,9 @@ + + + diff --git a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj index ee3d99a36601..88c739edefc3 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj +++ b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj @@ -113,12 +113,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -171,6 +174,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj index ad7ec1ae6c11..1fe5fc6102d7 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj @@ -65,6 +65,15 @@ False ..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.0.14.0-preview\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll + + True + + + True + + + True + False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -93,6 +102,11 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll + + + ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True + diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config index 85d8cae6409d..ba99ca5ffaf1 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config @@ -9,6 +9,9 @@ + + + diff --git a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj index 9706839753af..53a6d4ba3326 100644 --- a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj +++ b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj @@ -65,6 +65,18 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + + + True + + + True + + + True + + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -107,6 +119,10 @@ + + ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True + diff --git a/src/ResourceManager/Tags/Commands.Tags/packages.config b/src/ResourceManager/Tags/Commands.Tags/packages.config index bdde83a6dc79..ea11cabbd89e 100644 --- a/src/ResourceManager/Tags/Commands.Tags/packages.config +++ b/src/ResourceManager/Tags/Commands.Tags/packages.config @@ -8,6 +8,9 @@ + + + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj index e0f0df052783..805ea5b02c51 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj @@ -78,12 +78,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -145,6 +148,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj index 2a595f90105a..fac4204af61b 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj @@ -78,12 +78,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -149,6 +152,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureVMConfigInfo.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureVMConfigInfo.cs index 47959bc5b96c..f944aad93a7f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureVMConfigInfo.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureVMConfigInfo.cs @@ -19,12 +19,14 @@ public class AzureVMConfigInfo public string vmName; public string imageName; public string vmSize; + public string mediaLocation; - public AzureVMConfigInfo(string vmName, string vmSize, string imageName) + public AzureVMConfigInfo(string vmName, string vmSize, string imageName, string mediaLocation = null) { this.vmName = vmName; this.vmSize = vmSize; this.imageName = imageName; + this.mediaLocation = mediaLocation; } } } \ No newline at end of file diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index 9d305aead338..1ac1693a8c9d 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -557,26 +557,38 @@ public void AzureDeploymentTest() // Move the deployment from 'Staging' to 'Production' - vmPowershellCmdlets.MoveAzureDeployment(serviceName); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.MoveAzureDeployment(serviceName); + }, "The server encountered an internal error. Please retry the request.", 10, 30); result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Production); pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 1); Console.WriteLine("successfully moved"); // Set the deployment status to 'Suspended' - vmPowershellCmdlets.SetAzureDeploymentStatus(serviceName, DeploymentSlotType.Production, DeploymentStatus.Suspended); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.SetAzureDeploymentStatus(serviceName, DeploymentSlotType.Production, DeploymentStatus.Suspended); + }, "The server encountered an internal error. Please retry the request.", 10, 30); result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Production); pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, DeploymentStatus.Suspended, 1); Console.WriteLine("successfully changed the status"); // Update the deployment - vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Production, configPath2.FullName); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Production, configPath2.FullName); + }, "The server encountered an internal error. Please retry the request.", 10, 30); result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Production); pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 2); Console.WriteLine("successfully updated the deployment"); // Upgrade the deployment DateTime start = DateTime.Now; - vmPowershellCmdlets.SetAzureDeploymentUpgrade(serviceName, DeploymentSlotType.Production, UpgradeType.Simultaneous, packagePath2.FullName, configPath3.FullName); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.SetAzureDeploymentUpgrade(serviceName, DeploymentSlotType.Production, UpgradeType.Simultaneous, packagePath2.FullName, configPath3.FullName); + }, "The server encountered an internal error. Please retry the request.", 10, 30); TimeSpan duration = DateTime.Now - start; Console.WriteLine("Auto upgrade took {0}.", duration); @@ -584,7 +596,7 @@ public void AzureDeploymentTest() pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, serviceName, DeploymentSlotType.Production, null, 4); Console.WriteLine("successfully updated the deployment"); - var date = new DateTime(2014, 10, 17); + var date = DateTime.Now.AddMonths(-1); // Get Deployment Events by Name var events = vmPowershellCmdlets.GetAzureDeploymentEvent(serviceName, deploymentName, date, date.AddHours(1)); Assert.IsTrue(!events.Any() || events.All(e => e.DeploymentName == deploymentName diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/NewAzureVMConfigCmdletInfo.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/NewAzureVMConfigCmdletInfo.cs index bb06c5fcb852..579bbf3f1c01 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/NewAzureVMConfigCmdletInfo.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/NewAzureVMConfigCmdletInfo.cs @@ -26,6 +26,11 @@ public NewAzureVMConfigCmdletInfo(AzureVMConfigInfo vmConfig) this.cmdletParams.Add(new CmdletParam("Name", vmConfig.vmName)); this.cmdletParams.Add(new CmdletParam("ImageName", vmConfig.imageName)); this.cmdletParams.Add(new CmdletParam("InstanceSize", vmConfig.vmSize)); + + if (!string.IsNullOrEmpty(vmConfig.mediaLocation)) + { + this.cmdletParams.Add(new CmdletParam("MediaLocation", vmConfig.mediaLocation)); + } } } } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs index 932188ba5ebe..a6a4ddbc8abb 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs @@ -64,12 +64,27 @@ public void NewWindowsAzureQuickVM() { if (string.IsNullOrEmpty(imageName)) imageName = vmPowershellCmdlets.GetAzureVMImageName(new[] { "Windows" }, false); + + Utilities.RetryActionUntilSuccess(() => + { + var svcExists = vmPowershellCmdlets.TestAzureServiceName(serviceName); + if (svcExists) + { + // Try to delete the hosted service artifact in this subscription + vmPowershellCmdlets.RemoveAzureService(serviceName, true); + } + + vmPowershellCmdlets.NewAzureQuickVM(OS.Windows, newAzureQuickVMName1, serviceName, imageName, username, password, locationName); + }, "The server encountered an internal error. Please retry the request.", 10, 30); - vmPowershellCmdlets.NewAzureQuickVM(OS.Windows, newAzureQuickVMName1, serviceName, imageName, username, password, locationName); // Verify Assert.AreEqual(newAzureQuickVMName1, vmPowershellCmdlets.GetAzureVM(newAzureQuickVMName1, serviceName).Name, true); - vmPowershellCmdlets.NewAzureQuickVM(OS.Windows, newAzureQuickVMName2, serviceName, imageName, username, password); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.NewAzureQuickVM(OS.Windows, newAzureQuickVMName2, serviceName, imageName, username, password); + }, "The server encountered an internal error. Please retry the request.", 10, 30); + // Verify Assert.AreEqual(newAzureQuickVMName2, vmPowershellCmdlets.GetAzureVM(newAzureQuickVMName2, serviceName).Name, true); diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs index 21fcef1076f7..3976b8447e81 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs @@ -1402,9 +1402,9 @@ public ManagementOperationContext RemoveAzureVMImage(string imageName, bool dele return result; } - public void SaveAzureVMImage(string serviceName, string vmName, string newImageName, string osState = null, string newImageLabel = null, bool retyOnConflict = true) + public void SaveAzureVMImage(string serviceName, string vmName, string newImageName, string osState = null, string newImageLabel = null, bool debug = false, bool retryOnConflict = false) { - RunPSCmdletAndReturnFirst(new SaveAzureVMImageCmdletInfo(serviceName, vmName, newImageName, newImageLabel, osState), retyOnConflict); + RunPSCmdletAndReturnFirst(new SaveAzureVMImageCmdletInfo(serviceName, vmName, newImageName, newImageLabel, osState), debug, retryOnConflict); } public Collection GetAzureVMImage(string imageName = null) @@ -1414,7 +1414,17 @@ public void SaveAzureVMImage(string serviceName, string vmName, string newImageN public Collection GetAzureVMImageReturningVMImages(string imageName = null) { - return RunPSCmdletAndReturnAll(new GetAzureVMImageCmdletInfo(imageName)); + Collection images = GetAzureVMImage(); + Collection vmImages = new Collection(); + foreach (SM.OSImageContext image in images) + { + if (image is SM.VMImageContext) + { + vmImages.Add((SM.VMImageContext)image); + } + } + + return vmImages; } public string GetAzureVMImageName(string[] keywords, bool exactMatch = true) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs index dad30bf09b66..37c3d87e8ac4 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs @@ -352,6 +352,7 @@ public void AzureVMImageListRemoveTest() Console.WriteLine("------------------------------Try to save the OS image with an existing os image name: Completed---------------------------------"); //e. Save the OS image with a new image name. Console.WriteLine("------------------------------Save the OS image with a new image name.---------------------------------"); + vmPowershellCmdlets.StopAzureVM(vm, serviceName, true); vmPowershellCmdlets.SaveAzureVMImage(serviceName, vmName, newLabel); Console.WriteLine("------------------------------Save the OS image with a new image name: Completed---------------------------------"); //f. Deploy a new IaaS VM @@ -467,29 +468,30 @@ public void SaveAzureVMImageNegativeTest() vmPowershellCmdlets.NewAzureVM(serviceName, new[] { vm }); Console.WriteLine("------------------------------Deploy another new IaaS VM: completed---------------------------------"); //e. Stop the VM - Console.WriteLine("------------------------------Stop Azure VM---------------------------------"); + Console.WriteLine("------------------------------Stop the VM (for 2nd VM)---------------------------------"); vmPowershellCmdlets.StopAzureVM(vm, serviceName,force:true); string testImageName = Utilities.GetUniqueShortName(vmNamePrefix); - + Console.WriteLine("------------------------------Stop the VM (for 2nd VM): completed---------------------------------"); //f. Try to save the VM image with the existing name (must fail) - Console.WriteLine("------------------------------Try to save the VM image with the existing name (must fail)---------------------------------"); - Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, vmName1, vmImageName, CONSTANT_SPECIALIZED, vmImageName, false), ConflictErrorException); - + Console.WriteLine("------------------------------Save the VM image with the existing name (must fail)---------------------------------"); + Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, vmName1, vmImageName, CONSTANT_SPECIALIZED, vmImageName, false, false), ConflictErrorException); + Console.WriteLine("------------------------------Save the VM image with the existing name (must fail): completed---------------------------------"); //g. Try to save the VM image with the wrong vm name (must fail) - Console.WriteLine("------------------------------Try to save the VM image with the wrong vm name (must fail)---------------------------------"); + Console.WriteLine("------------------------------Save the VM image (must fail)---------------------------------"); Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, Utilities.GetUniqueShortName(vmNamePrefix), testImageName, CONSTANT_SPECIALIZED, testImageName), ResourceNotFoundException); - + Console.WriteLine("------------------------------Save the VM image (must fail): completed---------------------------------"); //h. Try to save the VM image with the wrong service name (must fail) - Console.WriteLine("------------------------------Try to save the VM image with the wrong service name (must fail)---------------------------------"); + Console.WriteLine("------------------------------Save the VM image with wrong name (must fail)---------------------------------"); string testVMIMage = Utilities.GetUniqueShortName("VMImage"); vmPowershellCmdlets.SaveAzureVMImage(Utilities.GetUniqueShortName(vmNamePrefix), vmName1, testVMIMage, CONSTANT_SPECIALIZED, testVMIMage); Utilities.VerifyFailure(() => vmPowershellCmdlets.GetAzureVMImage(testVMIMage),ResourceNotFoundException); - + Console.WriteLine("------------------------------Save the VM image with wrong name (must fail): completed---------------------------------"); //i. Try to save the VM image with the label longer than maximum length of string (must fail) + Console.WriteLine("------------------------------Save the VM image with long name (must fail)---------------------------------"); string LongImageName = Utilities.GetUniqueShortName(length:30) + Utilities.GetUniqueShortName(length:30)+ Guid.NewGuid().ToString() + Guid.NewGuid().ToString() ; - Console.WriteLine("Attempting to save a VMImage with name {0} of {1} characters and expecting it to fail.", LongImageName, LongImageName.Length); + Console.WriteLine("Attempting to save a VMImage with name {0} of {1} characters and expecting it to fail.", LongImageName,LongImageName.Length); Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, vmName1, testImageName, CONSTANT_SPECIALIZED, LongImageName), BadRequestException); - + Console.WriteLine("------------------------------Save the VM image with long name (must fail): completed---------------------------------"); pass = true; } catch (Exception ex) @@ -499,9 +501,9 @@ public void SaveAzureVMImageNegativeTest() } finally { - Console.WriteLine("------------------------------Delete the VM image---------------------------------"); + Console.WriteLine("------------------------------Delete the VM image (cleanup)---------------------------------"); DeleteVMImageIfExists(vmImageName); - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Deleted the VM image (cleanup): completed---------------------------------"); } } @@ -570,6 +572,59 @@ public void UpdateVMImageDataDiskAndOsDiskTest() } + [TestMethod(), TestCategory(Category.Scenario), TestProperty("Feature", "IaaS"), Priority(0), Owner("hylee"), Description("Test the cmdlets (Get-AzureVMImage, New-AzureVMConfig, New-AzureVM, Get-AzureVM, Remove-AzureVM, etc.)")] + public void CreateVirtualMachineUsingVMImageWithDataDisks() + { + StartTest(MethodBase.GetCurrentMethod().Name, DateTime.Now); + + try + { + // Try to get VM image with data disks + var vmImages = vmPowershellCmdlets.GetAzureVMImageReturningVMImages(); + var vmImage = vmImages.Where(t => t.OS == "Windows" && t.DataDiskConfigurations != null && t.DataDiskConfigurations.Any()).FirstOrDefault(); + + // New-AzureService and verify with Get-AzureService + vmPowershellCmdlets.NewAzureService(serviceName, serviceName, locationName); + Assert.IsTrue(Verify.AzureService(serviceName, serviceName, locationName)); + + // New-AzureVMConfig + var vmName = Utilities.GetUniqueShortName(vmNamePrefix); + var vmSize = vmPowershellCmdlets.GetAzureRoleSize().Where(t => t.MaxDataDiskCount != null && t.MaxDataDiskCount >= vmImage.DataDiskConfigurations.Count()).Select(t => t.InstanceSize).First(); + var currentStorage = vmPowershellCmdlets.GetAzureStorageAccount(defaultAzureSubscription.CurrentStorageAccountName).First(); + var mediaLocationStr = ("mloc" + vmName).ToLower(); + var vmMediaLocation = currentStorage.Endpoints.Where(p => p.Contains("blob")).First() + mediaLocationStr; + var azureVMConfigInfo = new AzureVMConfigInfo(vmName, vmSize, vmImage.ImageName, vmMediaLocation); + PersistentVM vm = vmPowershellCmdlets.NewAzureVMConfig(azureVMConfigInfo); + + // Add-AzureProvisioningConfig + AzureProvisioningConfigInfo azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password, true); + azureProvisioningConfig.Vm = vm; + vm = vmPowershellCmdlets.AddAzureProvisioningConfig(azureProvisioningConfig); + + // New-AzureVM + vmPowershellCmdlets.NewAzureVM(serviceName, new[] { vm }, null, null, null, null, null, null); + pass = true; + + // Get-AzureVM + var returnedVM = vmPowershellCmdlets.GetAzureVM(vmName, serviceName); + Assert.IsTrue(returnedVM.VM.DataVirtualHardDisks != null && returnedVM.VM.DataVirtualHardDisks.Count() == vmImage.DataDiskConfigurations.Count()); + Assert.IsTrue(returnedVM.VM.DataVirtualHardDisks.All(t => t.MediaLink.ToString().StartsWith(vmMediaLocation))); + + // Remove-AzureVM + vmPowershellCmdlets.RemoveAzureVM(vmName, serviceName); + + // Remove-AzureService + vmPowershellCmdlets.RemoveAzureService(serviceName, true); + + pass = true; + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + private void UpdateVmImageUsingDiskConfigSetAndVerifyChanges(DataDiskConfigurationList diskConfig, string disk1Name, string disk2Name) { cahcing = GetAlternateHostCachingForOsDisk(cahcing.ToString()); diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj index edf24aebccc9..ce4a45cee379 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj @@ -80,12 +80,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -155,6 +158,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs index e68837914729..cea2e5f40d24 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs @@ -281,7 +281,7 @@ public void NewAzureVMProcess() Label = this.DeploymentLabel ?? this.ServiceName, VirtualNetworkName = this.VNetName, Roles = { persistentVMs[0] }, - ReservedIPName = ReservedIPName, + ReservedIPName = ReservedIPName }; if (this.DnsSettings != null) @@ -370,7 +370,8 @@ public void NewAzureVMProcess() RoleSize = persistentVMs[i].RoleSize, ProvisionGuestAgent = persistentVMs[i].ProvisionGuestAgent, ResourceExtensionReferences = persistentVMs[i].ProvisionGuestAgent != null && persistentVMs[i].ProvisionGuestAgent.Value ? persistentVMs[i].ResourceExtensionReferences : null, - VMImageName = VMTuples[i].Item3 ? persistentVMs[i].VMImageName : null + VMImageName = VMTuples[i].Item3 ? persistentVMs[i].VMImageName : null, + MediaLocation = VMTuples[i].Item3 ? persistentVMs[i].MediaLocation : null }; if (parameter.OSVirtualHardDisk != null) @@ -431,7 +432,8 @@ private Management.Compute.Models.Role CreatePersistentVMRole(Tuple>(persistentVM.ResourceExtensionReferences) : null, - VMImageName = isVMImage ? persistentVM.OSVirtualHardDisk.SourceImageName : null + VMImageName = isVMImage ? persistentVM.OSVirtualHardDisk.SourceImageName : null, + MediaLocation = isVMImage ? persistentVM.OSVirtualHardDisk.MediaLink : null }; if (result.OSVirtualHardDisk != null) diff --git a/src/ServiceManagement/Compute/Sync/Sync.csproj b/src/ServiceManagement/Compute/Sync/Sync.csproj index 2e833c2bc682..d22072425396 100644 --- a/src/ServiceManagement/Compute/Sync/Sync.csproj +++ b/src/ServiceManagement/Compute/Sync/Sync.csproj @@ -53,12 +53,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll @@ -78,6 +81,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj b/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj index 786ed2f06e50..3e8e565f359d 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj @@ -69,12 +69,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True ..\..\..\packages\Microsoft.Hadoop.Client.1.3.3.2\lib\net40\Microsoft.Hadoop.Client.dll @@ -138,6 +141,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj index 4625783942d3..eb6bcdcc1512 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj @@ -60,12 +60,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -116,6 +119,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj index 14dbfcbac985..32c5d96a7ebc 100644 --- a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj +++ b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj @@ -49,6 +49,15 @@ ..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll True + + True + + + True + + + True + ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll @@ -107,6 +116,10 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll + + ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True + diff --git a/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj b/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj index 799e0157b5bb..56edb1f77c98 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj +++ b/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj @@ -77,12 +77,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -185,6 +188,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Services/Commands/Commands.csproj b/src/ServiceManagement/Services/Commands/Commands.csproj index 263cf2e345c9..a57a127e4d74 100644 --- a/src/ServiceManagement/Services/Commands/Commands.csproj +++ b/src/ServiceManagement/Services/Commands/Commands.csproj @@ -75,12 +75,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -187,6 +190,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj index 710c6a6502fb..bbc2372d1973 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj @@ -70,12 +70,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -134,6 +137,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj index ea8af24d5ceb..8cf2bf6cdbbd 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj +++ b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj @@ -63,12 +63,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -128,6 +131,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj index f084b7c8e9e5..0fc5b3ba3c5d 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj @@ -64,12 +64,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -119,6 +122,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True