Skip to content

Commit

Permalink
Merge pull request #12 from Azure/dev
Browse files Browse the repository at this point in the history
.
  • Loading branch information
huangpf committed Jun 1, 2015
2 parents a8f871f + fcada69 commit df8d6db
Show file tree
Hide file tree
Showing 29 changed files with 9,546 additions and 2,316 deletions.
34 changes: 31 additions & 3 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
2015.05.29 version 0.9.2
* Deprecated Switch-AzureMode
* Profile
* Fixed bug in Get-AzureSubscription and Select-AzureSubscription cmdlets
* Added Automation cmdlets
* Get-AzureAutomationWebhook
* New-AzureAutomationWebhook
* Remove-AzureAutomationWebhook
* Set-AzureAutomationWebhook
* Azure Compute
* Get-AzureVMImage and Get-AzureVMImageDetail are combined (Get-AzureVMImageDetail gives a warning message for future deprecation)
* Get-AzureVMExtensionImage and Get-AzureVMExtensionImageDetail are combined (Get-AzureVMExtensionImageDetail gives a warning message for future deprecation)
* Tags are added in VM resources
* Get-AzureVM now gets resource group name from piping
* -All switch is removed from Get-AzureVM
* Get-AzureVM -Status output is updated
* -Force parameter is added for Remove-AzureAvailabilitySet
* Outputs of New-AzureAvailabilitySet, Get-AzureAvailabilitySet, and Remove-AzureAvailabilitySet are updated
* Azure Key Vault
* Update Set-AzureKeyVaultAccessPolicy and Remove-AzureKeyVaultAccessPolicy cmdlets
* Fixed bugs
* Azure Data Factories
* Base cmdlet type switch to use Profile
* New-AzureDataFactoryEncryptedValue cmdlet supporting M data sources
* Azure Resource Manager
* Fixed bug in Move-AzureResource cmdlet
* Fixed bug in Set-AzureResource cmdlet

2015.05.04 version 0.9.1
* Azure SQL Database: new support for configuring audit retention.
* Azure Automation
Expand Down Expand Up @@ -332,7 +360,7 @@
* Set-AzureVMCustomScriptExtension
* Set-AzureVMAccessExtension
* Show 'Regions' property for Get-AzureVMAvailableExtensions cmdlet
* Add 'ResizedSizeInGB' pramater for the following cmdlets
* Add 'ResizedSizeInGB' parameter for the following cmdlets
* Update-AzureDisk
* Set-AzureOSDisk
* Set-AzureDataDisk (DiskName parameter is also added along with ResizedSizeInGB)
Expand Down Expand Up @@ -437,7 +465,7 @@
* Compute
* Set-AzureVMImage cmdlets - added IconUri, SmallIconUri, and ShowInGui parameters
* Sql
* Added Sql Servver v12 support to SQL authentication context for SqlAzure cmdlets
* Added Sql Server v12 support to SQL authentication context for SqlAzure cmdlets

2014.11.14 Version 0.8.11
* Profile
Expand Down Expand Up @@ -760,7 +788,7 @@
* Remove-AzureVMImageOSDiskConfig
* Set-AzureVMImageDataDiskConfig
* Remove-AzureVMImageDataDiskConfig
* Virtual network improvments
* Virtual network improvements
* Set-AzureVnetGatewayKey
* Azure Automation cmdlets
* Get-AzureAutomationAccount
Expand Down
2 changes: 1 addition & 1 deletion setup/azurecmd.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<?define sourceDir="$(var.SolutionDir)..\src\Package\$(var.Configuration)" ?>
<?define caSourceDir="$(var.SolutionDir)setup\bin\$(var.Configuration)" ?>

<?define version="0.9.1" ?>
<?define version="0.9.2" ?>
<?define versionedStartMenuFolder="Microsoft Azure" ?>
<?define staleStartMenuFolder="Windows Azure" ?>

Expand Down
336 changes: 336 additions & 0 deletions setup/azurecmdfiles.wxi

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Common/Commands.Common/AzurePowerShell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class AzurePowerShell

public const string AssemblyCopyright = "Copyright © Microsoft";

public const string AssemblyVersion = "0.9.1";
public const string AssemblyVersion = "0.9.2";

public const string AssemblyFileVersion = "0.9.1";
public const string AssemblyFileVersion = "0.9.2";

public const string ProfileFile = "AzureProfile.json";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,14 @@ function Test-VirtualMachineProfile

# Network
$ipname = 'hpfip' + ((Get-Random) % 10000);
$ipRefUri1 = "https://test.foo.bar/$ipname";
$ipRefUri = "https://test.foo.bar/$ipname";
$nicName = $ipname + 'nic1';
$publicIPName = $ipname + 'name1';

$p = Add-AzureVMNetworkInterface -VM $p -Id $ipRefUri1;

$ipname = 'hpfip' + ((Get-Random) % 10000);
$ipRefUri2 = "https://test.foo.bar/$ipname";
$p = Add-AzureVMNetworkInterface -VM $p -Id $ipRefUri2;

# Remove all NICs
$p = $p | Remove-AzureVMNetworkInterface
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces.Count 0;

$p = Add-AzureVMNetworkInterface -VM $p -Id $ipRefUri1;
$p = Add-AzureVMNetworkInterface -VM $p -Id $ipRefUri2;
$p = Remove-AzureVMNetworkInterface -VM $p -Id $ipRefUri2;
$p = Add-AzureVMNetworkInterface -VM $p -Id $ipRefUri;

Assert-AreEqual $p.NetworkProfile.NetworkInterfaces.Count 1;
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces[0].ReferenceUri $ipRefUri1;
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces[0].ReferenceUri $ipRefUri;

# Storage
$stoname = 'hpfteststo' + ((Get-Random) % 10000);
Expand Down Expand Up @@ -78,23 +66,6 @@ function Test-VirtualMachineProfile
Assert-AreEqual $p.StorageProfile.DataDisks[1].Lun 1;
Assert-AreEqual $p.StorageProfile.DataDisks[1].VirtualHardDisk.Uri $dataDiskVhdUri2;

# Remove all data disks
$p = $p | Remove-AzureVMDataDisk;
Assert-AreEqual $p.StorageProfile.DataDisks.Count 0;

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

Assert-AreEqual $p.StorageProfile.DataDisks.Count 2;
Assert-AreEqual $p.StorageProfile.DataDisks[0].Caching 'ReadOnly';
Assert-AreEqual $p.StorageProfile.DataDisks[0].DiskSizeGB 10;
Assert-AreEqual $p.StorageProfile.DataDisks[0].Lun 0;
Assert-AreEqual $p.StorageProfile.DataDisks[0].VirtualHardDisk.Uri $dataDiskVhdUri1;
Assert-AreEqual $p.StorageProfile.DataDisks[1].Caching 'ReadOnly';
Assert-AreEqual $p.StorageProfile.DataDisks[1].DiskSizeGB 11;
Assert-AreEqual $p.StorageProfile.DataDisks[1].Lun 1;
Assert-AreEqual $p.StorageProfile.DataDisks[1].VirtualHardDisk.Uri $dataDiskVhdUri2;

# Windows OS
$user = "Foo12";
$password = 'BaR@000' + ((Get-Random) % 10000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,6 @@
<Label>StorageProfile</Label>
<PropertyName>StorageProfileText</PropertyName>
</ListItem>
<ListItem>
<Label>DataDiskNames</Label>
<PropertyName>DataDiskNames</PropertyName>
</ListItem>
<ListItem>
<Label>NetworkInterfaceIds</Label>
<PropertyName>NetworkInterfaceIds</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public string ResourceGroupName
{
get
{
if (string.IsNullOrEmpty(Id)) return null;
Regex r = new Regex(@"(.*?)/resourcegroups/(?<rgname>\S+)/providers/(.*?)", RegexOptions.IgnoreCase);
Match m = r.Match(Id);
return m.Success ? m.Groups["rgname"].Value : null;
Expand Down Expand Up @@ -135,37 +134,5 @@ public string StorageProfileText
{
get { return JsonConvert.SerializeObject(StorageProfile, Formatting.Indented); }
}

[JsonIgnore]
public string [] DataDiskNames
{
get
{
if (this.StorageProfile == null) return null;

var dataDiskNames = new List<string>();
foreach (var disk in StorageProfile.DataDisks)
{
dataDiskNames.Add(disk.Name);
}
return dataDiskNames.ToArray();
}
}

[JsonIgnore]
public string[] NetworkInterfaceIds
{
get
{
if (this.NetworkProfile == null) return null;

var nicIds = new List<string>();
foreach (var nic in NetworkProfile.NetworkInterfaces)
{
nicIds.Add(nic.ReferenceUri);
}
return nicIds.ToArray();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ public class RemoveAzureVMDataDiskCommand : AzurePSCmdlet
[ValidateNotNullOrEmpty]
public PSVirtualMachine VM { get; set; }

[Alias("Name")]
[Parameter(
Mandatory = true,
Position = 1,
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMDataDiskName)]
[ValidateNotNullOrEmpty]
public string [] DataDiskNames { get; set; }
public string Name { get; set; }

public override void ExecuteCmdlet()
{
Expand All @@ -55,10 +54,7 @@ public override void ExecuteCmdlet()
{
var disks = storageProfile.DataDisks.ToList();
var comp = StringComparison.OrdinalIgnoreCase;
foreach (var diskName in DataDiskNames)
{
disks.RemoveAll(d => string.Equals(d.Name, diskName, comp));
}
disks.RemoveAll(d => string.Equals(d.Name, this.Name, comp));
storageProfile.DataDisks = disks;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,30 @@ public class RemoveAzureVMNetworkInterfaceCommand : AzurePSCmdlet
[ValidateNotNullOrEmpty]
public PSVirtualMachine VM { get; set; }

[Alias("Id", "NicIds")]
[Alias("NicId", "NetworkInterfaceId")]
[Parameter(
Mandatory = true,
Position = 1,
ValueFromPipelineByPropertyName = true,
HelpMessage = HelpMessages.VMNetworkInterfaceID)]
[ValidateNotNullOrEmpty]
public string[] NetworkInterfaceIds { get; set; }
public string Id { get; set; }

public override void ExecuteCmdlet()
{
var networkProfile = this.VM.NetworkProfile;

foreach (var id in this.NetworkInterfaceIds)
if (networkProfile != null && networkProfile.NetworkInterfaces != null && networkProfile.NetworkInterfaces.Any(nic => string.Equals(nic.ReferenceUri, this.Id, StringComparison.OrdinalIgnoreCase)))
{
if (networkProfile != null &&
networkProfile.NetworkInterfaces != null &&
networkProfile.NetworkInterfaces.Any(nic =>
string.Equals(nic.ReferenceUri, id, StringComparison.OrdinalIgnoreCase)))
var nicReference = networkProfile.NetworkInterfaces.First(nic => string.Equals(nic.ReferenceUri, this.Id, StringComparison.OrdinalIgnoreCase));
networkProfile.NetworkInterfaces.Remove(nicReference);

if (!networkProfile.NetworkInterfaces.Any())
{
var nicReference = networkProfile.NetworkInterfaces.First(nic => string.Equals(nic.ReferenceUri, id, StringComparison.OrdinalIgnoreCase));
networkProfile.NetworkInterfaces.Remove(nicReference);
networkProfile = null;
}
}

if (!networkProfile.NetworkInterfaces.Any())
{
networkProfile = null;
}
this.VM.NetworkProfile = networkProfile;

WriteObject(this.VM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@
<Compile Include="RestClients\ResourceManagerRestRestClient.cs" />
<Compile Include="Utilities\HttpUtility.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="MSSharedLibKey.snk" />
<None Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
using Newtonsoft.Json.Linq;

/// <summary>
/// Gets the resource lock.
/// Gets the deployment operation.
/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureResourceGroupDeploymentOperation"), OutputType(typeof(PSObject))]
public class GetAzureResourceGroupDeploymentOperationCmdlet : ResourceManagerCmdletBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
using Newtonsoft.Json.Linq;

/// <summary>
/// A cmdlet that creates a new azure resource.
/// A cmdlet that invokes a resource action.
/// </summary>
[Cmdlet(VerbsLifecycle.Invoke, "AzureResourceAction", SupportsShouldProcess = true, DefaultParameterSetName = ResourceManipulationCmdletBase.ResourceIdParameterSet), OutputType(typeof(PSObject))]
public sealed class InvokAzureResourceActionCmdlet : ResourceManipulationCmdletBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Resources;

/// <summary>
/// A cmdlet that creates a new azure resource.
/// A cmdlet that removes an azure resource.
/// </summary>
[Cmdlet(VerbsCommon.Remove, "AzureResource", SupportsShouldProcess = true, DefaultParameterSetName = ResourceManipulationCmdletBase.ResourceIdParameterSet), OutputType(typeof(PSObject))]
public class RemoveAzureResourceCmdlet : ResourceManipulationCmdletBase
Expand Down
Loading

0 comments on commit df8d6db

Please sign in to comment.