Skip to content

Commit

Permalink
Merge remote-tracking branch 'azure1/experiments' into sergey-compute…
Browse files Browse the repository at this point in the history
…-class
  • Loading branch information
sergey-shandar committed Sep 18, 2017
2 parents 72f2658 + cb572aa commit 5d6f336
Show file tree
Hide file tree
Showing 327 changed files with 790,113 additions and 436 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ For Storage, this change log is located at `src\Storage\ChangeLog.md`.

#### Breaking Changes

Breaking changes should **not** be introduced into the repository without giving customers at least six months notice. For a description of breaking changes in Azure PowerShell, see [here](https://github.com/Azure/azure-powershell/blob/dev/documentation/breaking-changes/breaking-changes-definition.md).
Breaking changes should **not** be introduced into the repository without giving customers at least six months notice. For a description of breaking changes in Azure PowerShell, see [here](documentation/breaking-changes/breaking-changes-definition.md).

Whenever a service team announces a breaking change, they must add it to the `upcoming-breaking-changes.md` file in their respective service folder. When the service team is ready to release the module with the breaking change, they must move the corresponding information from `upcoming-breaking-changes.md` into the `current-breaking-changes.md` file located in their service folder.

Expand Down
3 changes: 2 additions & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@
<Output TaskParameter="AuthCodeSignTaskErrorsDetected" PropertyName="AuthTaskFailed" />
</VerifyAuthenticodeSignatureTask>

<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CheckStrongNameSignature.ps1 &quot;"/>
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(LibrarySourceFolder)\Package\$(Configuration) &quot;"
ContinueOnError="ErrorAndContinue" />

<!-- Copying signed shortcut back -->
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
Expand Down
4 changes: 0 additions & 4 deletions setup/azurecmdfiles.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -1556,9 +1556,6 @@
<Component Id="cmpC67F14F377421F1BCD74EC5A579D43CB" Guid="*">
<File Id="filE9553CEC1D67AB3D4B77759239D60B18" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.IotHub\Microsoft.Azure.Commands.IotHub.dll-Help.xml" />
</Component>
<Component Id="cmpD844DA64698210481D550B5CD8799D26" Guid="*">
<File Id="filA23D9B350E9B87D17B90B2181AE71E4B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.IotHub\Microsoft.Azure.Commands.IotHub.format.ps1xml" />
</Component>
<Component Id="cmp31610C192ED2776279BBDA3D9905552E" Guid="*">
<File Id="filB571C170B96736E7EE17BBF869A203A8" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.IotHub\Microsoft.Azure.Commands.ResourceManager.Common.dll" />
</Component>
Expand Down Expand Up @@ -5842,7 +5839,6 @@
<ComponentRef Id="cmp9DFE8C2688F7DF1A3DFF20EFA59BF3B5" />
<ComponentRef Id="cmpE29D513714759F365A7C0A2A7F2B5DC6" />
<ComponentRef Id="cmpC67F14F377421F1BCD74EC5A579D43CB" />
<ComponentRef Id="cmpD844DA64698210481D550B5CD8799D26" />
<ComponentRef Id="cmp31610C192ED2776279BBDA3D9905552E" />
<ComponentRef Id="cmpB0A6B8E083FEAEC29D41F54189DC6605" />
<ComponentRef Id="cmpB2620706D83DB49D3434BB39A5495055" />
Expand Down
13 changes: 12 additions & 1 deletion src/Common/Commands.Common/AzurePSCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ protected override void ProcessRecord()
base.ProcessRecord();
ExecuteCmdlet();
}
catch (Exception ex)
catch (Exception ex) when (!IsTerminatingError(ex))
{
WriteExceptionError(ex);
}
Expand All @@ -697,5 +697,16 @@ public void Dispose()
Dispose(true);
GC.SuppressFinalize(this);
}

public virtual bool IsTerminatingError(Exception ex)
{
var pipelineStoppedEx = ex as PipelineStoppedException;
if (pipelineStoppedEx != null && pipelineStoppedEx.InnerException == null)
{
return true;
}

return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.5" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.5" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.2.9-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,23 @@ function Test-VirtualMachineProfile
$osDiskVhdUri = "https://$stoname.blob.core.windows.net/test/os.vhd";
$dataDiskVhdUri1 = "https://$stoname.blob.core.windows.net/test/data1.vhd";
$dataDiskVhdUri2 = "https://$stoname.blob.core.windows.net/test/data2.vhd";
$dataDiskVhdUri3 = "https://$stoname.blob.core.windows.net/test/data3.vhd";

$p = Set-AzureRmVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption Empty;

$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 0 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 1 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB $null -Lun 2 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;

# Managed data disk setting
$managedDataDiskId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rggroup/providers/Microsoft.Compute/disks/dataDisk";
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB $null -Lun 2 -CreateOption Empty -ManagedDiskId $managedDataDiskId -StorageAccountType StandardLRS;
Assert-AreEqual $managedDataDiskId $p.StorageProfile.DataDisks[2].ManagedDisk.Id;
Assert-AreEqual "StandardLRS" $p.StorageProfile.DataDisks[2].ManagedDisk.StorageAccountType;
Assert-Null $p.StorageProfile.DataDisks[2].DiskSizeGB;

$p = Set-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -StorageAccountType PremiumLRS;
Assert-AreEqual $managedDataDiskId $p.StorageProfile.DataDisks[2].ManagedDisk.Id;
Assert-AreEqual "PremiumLRS" $p.StorageProfile.DataDisks[2].ManagedDisk.StorageAccountType;

$p = Remove-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3';

Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public static class HelpMessages
public const string VMDataDiskLun = "The virtual machine data disk's Lun.";
public const string VMDataDiskCreateOption = "The virtual machine data disk's create option.";

public const string VMManagedDiskId = "The virtual machine managed disk's Id.";
public const string VMManagedDiskAccountType = "The virtual machine managed disk's account type.";

public const string VMNetworkInterfaceName = "The virtual machine network interface's name.";
public const string VMNetworkInterfaceID = "The virtual machine network interface's ID.";
public const string VMPublicIPAddressName = "The virtual machine public IP address's name.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Param(
)

$VerbosePreference = "Continue"
$ErrorActionPreference = Stop
$ErrorActionPreference = "Stop"

########################################################################################################################
# Section1: Log-in to Azure and select appropriate subscription.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -565,4 +565,7 @@ The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip)
<data name="DiagnosticsExtensionMismatchStorageAccountName" xml:space="preserve">
<value>Storage account names provided in public and private configs do not match.</value>
</data>
<data name="NotManagedDisk" xml:space="preserve">
<value>The given disk is not a managed disk.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ public class AddAzureVMDataDiskCommand : Microsoft.Azure.Commands.ResourceManage

[Parameter(
Position = 8,
ValueFromPipelineByPropertyName = true)]
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMManagedDiskId)]
[ValidateNotNullOrEmpty]
public string ManagedDiskId { get; set; }

[Parameter(
Position = 9,
ValueFromPipelineByPropertyName = true)]
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
[ValidateNotNullOrEmpty]
public StorageAccountTypes? StorageAccountType { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ public class SetAzureVMDataDiskCommand : Microsoft.Azure.Commands.ResourceManage
[AllowNull]
public int? DiskSizeInGB { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
[ValidateNotNullOrEmpty]
public StorageAccountTypes? StorageAccountType { get; set; }

public override void ExecuteCmdlet()
{
var storageProfile = this.VM.StorageProfile;
Expand Down Expand Up @@ -102,6 +109,22 @@ public override void ExecuteCmdlet()
{
dataDisk.DiskSizeGB = this.DiskSizeInGB;
}
if (this.StorageAccountType != null)
{
if (dataDisk.ManagedDisk == null)
{
ThrowTerminatingError
(new ErrorRecord(
new InvalidOperationException(Properties.Resources.NotManagedDisk),
string.Empty,
ErrorCategory.InvalidData,
null));
}
else
{
dataDisk.ManagedDisk.StorageAccountType = this.StorageAccountType;
}
}
}

this.VM.StorageProfile = storageProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,15 @@ public class SetAzureVMOSDiskCommand : Microsoft.Azure.Commands.ResourceManager.

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMManagedDiskId)]
[ValidateNotNullOrEmpty]
public string ManagedDiskId { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
[ValidateNotNullOrEmpty]
public StorageAccountTypes? StorageAccountType { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The **Remove-AzureRmVMDscExtension** cmdlet removes a Desired State Configuratio

### Example 1: Remove a DSC extension
```
PS C:\> Remove-AzureRmVMDscExtension -ResouceGroupName "ResourceGroup001" -VMName "VM07" -Name "DSC"
PS C:\> Remove-AzureRmVMDscExtension -ResourceGroupName "ResourceGroup001" -VMName "VM07" -Name "DSC"
```

This command removes the extension named DSC on virtual machine named VM07.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Modifies properties of a virtual machine data disk.
### ChangeWithName
```
Set-AzureRmVMDataDisk [-VM] <PSVirtualMachine> [-Name] <String> [[-Caching] <CachingTypes>]
[[-DiskSizeInGB] <Int32>] [<CommonParameters>]
[[-DiskSizeInGB] <Int32>] [-StorageAccountType <StorageAccountTypes>] [<CommonParameters>]
```

### ChangeWithLun
```
Set-AzureRmVMDataDisk [-VM] <PSVirtualMachine> [-Lun] <Int32> [[-Caching] <CachingTypes>]
[[-DiskSizeInGB] <Int32>] [<CommonParameters>]
[[-DiskSizeInGB] <Int32>] [-StorageAccountType <StorageAccountTypes>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -114,6 +114,22 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -StorageAccountType
The virtual machine managed disk's account type.
```yaml
Type: StorageAccountTypes
Parameter Sets: (All)
Aliases:
Accepted values: StandardLRS, PremiumLRS

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -VM
Specifies the virtual machine for which this cmdlet modifies a data disk.
To obtain a virtual machine object, use the Get-AzureRmVM cmdlet.
Expand All @@ -136,7 +152,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## INPUTS
### PSVirtualMachine
Parameter 'VM' accepts value of type 'PSVirtualMachine' from the pipeline
## OUTPUTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.Job.2.0.3\lib\net40\Microsoft.Azure.Management.HDInsight.Job.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.Job.2.0.4\lib\net40\Microsoft.Azure.Management.HDInsight.Job.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public virtual void SetupManagementClientForJobTests()
.Verifiable();

var configurationResponse = new Dictionary<string, string>();
configurationResponse.Add("fs.defaultFS", "wasb://[email protected]");
configurationResponse.Add("fs.azure.account.key.xyz.blob.core.windows.net", "tempkey");

hdinsightManagementMock.Setup(c => c.GetClusterConfigurations(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
.Returns(configurationResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Moq;
using Xunit;
using System.IO;
using System.Text;

namespace Microsoft.Azure.Commands.HDInsight.Test
{
Expand Down Expand Up @@ -228,6 +230,34 @@ public void GetJobWithIdProvided()
f.WriteObject(It.Is<AzureHDInsightJob>(job => job.JobId.Equals(jobId))));
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetJobOutput()
{
string sampleOutput = "1";
// Update HDInsight Management properties for Job.
SetupManagementClientForJobTests();
var jobId = "jobid_1984120_001";
var cmdlet = GetJobOutputCommandDefinition();
cmdlet.JobId = jobId;

MemoryStream jobOutput = new MemoryStream(Encoding.UTF8.GetBytes(sampleOutput));

var reader = new StreamReader(jobOutput);
var text = reader.ReadToEnd();
jobOutput.Seek(0, SeekOrigin.Begin);

hdinsightJobManagementMock.Setup(c => c.GetJobOutput(It.IsAny<string>(),It.IsAny<IStorageAccess>()))
.Returns(jobOutput)
.Verifiable();

cmdlet.ExecuteCmdlet();
commandRuntimeMock.VerifyAll();
commandRuntimeMock.Verify(
f =>
f.WriteObject(It.Is<string>(Output => Output.Equals(text))));
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ListJobs()
Expand Down Expand Up @@ -383,6 +413,20 @@ public GetAzureHDInsightJobCommand GetJobCommandDefinition()
return cmdlet;
}

public GetAzureHDInsightJobOutputCommand GetJobOutputCommandDefinition()
{
var cmdlet = new GetAzureHDInsightJobOutputCommand
{
CommandRuntime = commandRuntimeMock.Object,
HDInsightJobClient = hdinsightJobManagementMock.Object,
HDInsightManagementClient = hdinsightManagementMock.Object,
HttpCredential = new PSCredential("httpuser", string.Format("Password1!").ConvertToSecureString()),
ClusterName = ClusterName
};

return cmdlet;
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void WaitForJobCompletion_Sucess()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="0.18.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.HDInsight" version="2.0.7" targetFramework="net45" />
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.4" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Test.Framework" version="1.0.6179.26854-prerelease" targetFramework="net45" />
Expand Down
Loading

0 comments on commit 5d6f336

Please sign in to comment.