Skip to content

Commit

Permalink
Add Arm64 and DataAccessAuthMode feature for Compute cmdlets (#18131)
Browse files Browse the repository at this point in the history
* updates to cmdlets

* fix NewGalleryImage instead of update, add md files, update changelog

* update last md

* Feature/cplat data auth access (#18137)

* add -DataAccessAuthMode to Snaptshot/Disk config/updateConfig

* trying DataAuth in Add-AzVhd

* progress save for Add-AzVhd

* remove add-azvhd stuff

* md files

* Update ChangeLog.md

Co-authored-by: Yunchi Wang <[email protected]>
  • Loading branch information
grizzlytheodore and wyunchi-ms authored May 13, 2022
1 parent 7ea5b5b commit e6a6ae8
Show file tree
Hide file tree
Showing 18 changed files with 282 additions and 25 deletions.
11 changes: 11 additions & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
-->
## Upcoming Release
* Edited `New-AzVm` cmdlet internal logic to use the `PlatformFaultDomain` value in the `PSVirtualMachine` object passed to it in the new virtual machine.
* Added `-DataAccessAuthMode` parameter to the following cmdlets:
- `New-AzDiskConfig`
- `New-AzDiskUpdateConfig`
- `New-AzSnapshotConfig`
- `New-AzSnapshotUpdateConfig`
* Added `-Architecture` parameter to the following cmdlets:
- `New-AzDiskConfig`
- `New-AzDiskUpdateConfig`
- `New-AzSnapshotConfig`
- `New-AzSnapshotUpdateConfig`
- `New-AzGalleryImageDefinition`

## Version 4.26.0
* Added `-ImageReferenceId` parameter to following cmdlets: `New-AzVm`, `New-AzVmConfig`, `New-AzVmss`, `Set-AzVmssStorageProfile`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,20 @@ public partial class NewAzureRmDiskConfigCommand : Microsoft.Azure.Commands.Reso
HelpMessage = "True if the image from which the OS disk is created supports accelerated networking.")]
public bool? AcceleratedNetwork { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Additional authentication requirements when exporting or uploading to a disk or snapshot.")]
[PSArgumentCompleter("AzureActiveDirectory", "None")]
public string DataAccessAuthMode { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "CPU architecture supported by an OS disk. Possible values are \"X64\" and \"Arm64\".")]
[PSArgumentCompleter("X64", "Arm64")]
public string Architecture { get; set; }

protected override void ProcessRecord()
{
if (ShouldProcess("Disk", "New"))
Expand Down Expand Up @@ -418,6 +432,15 @@ private void Run()
vSupportedCapabilities.AcceleratedNetwork = AcceleratedNetwork;
}

if (this.IsParameterBound(c => c.Architecture))
{
if (vSupportedCapabilities == null)
{
vSupportedCapabilities = new SupportedCapabilities();
}
vSupportedCapabilities.Architecture = this.Architecture;
}

var vDisk = new PSDisk
{
Zones = this.IsParameterBound(c => c.Zone) ? this.Zone : null,
Expand All @@ -443,7 +466,8 @@ private void Run()
PurchasePlan = this.IsParameterBound(c => c.PurchasePlan) ? this.PurchasePlan : null,
SupportsHibernation = this.IsParameterBound(c => c.SupportsHibernation) ? SupportsHibernation : null,
SupportedCapabilities = vSupportedCapabilities,
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null,
DataAccessAuthMode = this.IsParameterBound(c => c.DataAccessAuthMode) ? DataAccessAuthMode : null
};

WriteObject(vDisk);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,20 @@ public partial class NewAzureRmDiskUpdateConfigCommand : Microsoft.Azure.Command
HelpMessage = "True if the image from which the OS disk is created supports accelerated networking.")]
public bool? AcceleratedNetwork { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Additional authentication requirements when exporting or uploading to a disk or snapshot.")]
[PSArgumentCompleter("AzureActiveDirectory", "None")]
public string DataAccessAuthMode { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "CPU architecture supported by an OS disk. Possible values are \"X64\" and \"Arm64\".")]
[PSArgumentCompleter("X64", "Arm64")]
public string Architecture { get; set; }


protected override void ProcessRecord()
{
Expand Down Expand Up @@ -274,6 +288,15 @@ private void Run()
vSupportedCapabilities.AcceleratedNetwork = AcceleratedNetwork;
}

if (this.IsParameterBound(c => c.Architecture))
{
if (vSupportedCapabilities == null)
{
vSupportedCapabilities = new SupportedCapabilities();
}
vSupportedCapabilities.Architecture = this.Architecture;
}

var vDiskUpdate = new PSDiskUpdate
{
OsType = this.IsParameterBound(c => c.OsType) ? this.OsType : (OperatingSystemTypes?)null,
Expand All @@ -294,7 +317,8 @@ private void Run()
PurchasePlan = this.IsParameterBound(c => c.PurchasePlan) ? this.PurchasePlan : null,
SupportsHibernation = this.IsParameterBound(c => c.SupportsHibernation) ? SupportsHibernation : null,
SupportedCapabilities = vSupportedCapabilities,
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null,
DataAccessAuthMode = this.IsParameterBound(c => c.DataAccessAuthMode) ? DataAccessAuthMode : null
};

WriteObject(vDiskUpdate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public override void ExecuteCmdlet()
galleryImage.EndOfLifeDate = this.EndOfLifeDate;
}

if (this.IsParameterBound(c => c.Architecture))
{
galleryImage.Architecture = this.Architecture;
}

if (this.IsParameterBound(c => c.Tag))
{
galleryImage.Tags = this.Tag.Cast<DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value);
Expand Down Expand Up @@ -327,6 +332,13 @@ public override void ExecuteCmdlet()
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
public GalleryImageFeature[] Feature { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "CPU architecture supported by an OS disk. Possible values are \"X64\" and \"Arm64\".")]
[PSArgumentCompleter("X64", "Arm64")]
public string Architecture { get; set; }
}

[Cmdlet(VerbsData.Update, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "GalleryImageDefinition", DefaultParameterSetName = "DefaultParameter", SupportsShouldProcess = true)]
Expand Down
11 changes: 1 addition & 10 deletions src/Compute/Compute/Generated/Models/PSDisk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,15 @@ public string ResourceGroupName
public string Location { get; set; }
public ExtendedLocation ExtendedLocation { get; set; }
public IDictionary<string, string> Tags { get; set; }
// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', 'DenyAll'
public string NetworkAccessPolicy { get; set; }
public string DiskAccessId { get; set; }
public string Tier { get; set; }
public bool? BurstingEnabled { get; set; }
public PSPurchasePlan PurchasePlan { get; set; }
public bool? SupportsHibernation { get; set; }
public DiskSecurityProfile SecurityProfile { get; set; }

//
// Summary:
// Gets or sets possible values include: 'Enabled', 'Disabled'
public string PublicNetworkAccess { get; set; }

//
// Summary:
// Gets or sets list of supported capabilities for the image from which the OS disk
// was created.
public SupportedCapabilities SupportedCapabilities { get; set; }
public string DataAccessAuthMode { get; set; }
}
}
1 change: 1 addition & 0 deletions src/Compute/Compute/Generated/Models/PSDiskUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ public partial class PSDiskUpdate
// Summary:
// Gets or sets possible values include: 'Enabled', 'Disabled'
public string PublicNetworkAccess { get; set; }
public string DataAccessAuthMode { get; set; }
}
}
1 change: 1 addition & 0 deletions src/Compute/Compute/Generated/Models/PSGalleryImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public string ResourceGroupName
public string Location { get; set; }
public IDictionary<string, string> Tags { get; set; }
public IList<GalleryImageFeature> Features { get; set; }
public string Architecture { get; set; }

}
}
2 changes: 1 addition & 1 deletion src/Compute/Compute/Generated/Models/PSSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ public string ResourceGroupName
// Gets or sets percentage complete for the background copy when a resource is created
// via the CopyStart operation.
public double? CompletionPercent { get; set; }

public string DataAccessAuthMode { get; set; }
}
}
2 changes: 2 additions & 0 deletions src/Compute/Compute/Generated/Models/PSSnapshotUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ public partial class PSSnapshotUpdate
public IDictionary<string, string> Tags { get; set; }
public SnapshotSku Sku { get; set; }
public bool? SupportsHibernation { get; set; }
public SupportedCapabilities SupportedCapabilities { get; set; }

//
// Summary:
// Gets or sets possible values include: 'Enabled', 'Disabled'
public string PublicNetworkAccess { get; set; }
public string DataAccessAuthMode { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ public partial class NewAzureRmSnapshotConfigCommand : Microsoft.Azure.Commands.
HelpMessage = "True if the image from which the OS disk is created supports accelerated networking.")]
public bool? AcceleratedNetwork { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Additional authentication requirements when exporting or uploading to a disk or snapshot.")]
[PSArgumentCompleter("AzureActiveDirectory", "None")]
public string DataAccessAuthMode { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "CPU architecture supported by an OS disk. Possible values are \"X64\" and \"Arm64\".")]
[PSArgumentCompleter("X64", "Arm64")]
public string Architecture { get; set; }

protected override void ProcessRecord()
{
if (ShouldProcess("Snapshot", "New"))
Expand Down Expand Up @@ -336,6 +350,15 @@ private void Run()
vSupportedCapabilities.AcceleratedNetwork = AcceleratedNetwork;
}

if (this.IsParameterBound(c => c.Architecture))
{
if (vSupportedCapabilities == null)
{
vSupportedCapabilities = new SupportedCapabilities();
}
vSupportedCapabilities.Architecture = this.Architecture;
}

var vSnapshot = new PSSnapshot
{
OsType = this.IsParameterBound(c => c.OsType) ? this.OsType : (OperatingSystemTypes?)null,
Expand All @@ -354,7 +377,8 @@ private void Run()
PurchasePlan = this.IsParameterBound(c => c.PurchasePlan) ? this.PurchasePlan : null,
SupportsHibernation = this.IsParameterBound(c => c.SupportsHibernation) ? SupportsHibernation : null,
SupportedCapabilities = vSupportedCapabilities,
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null,
DataAccessAuthMode = this.IsParameterBound(c => c.DataAccessAuthMode) ? DataAccessAuthMode : null
};

WriteObject(vSnapshot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ public partial class NewAzureRmSnapshotUpdateConfigCommand : Microsoft.Azure.Com
[PSArgumentCompleter("Enabled", "Disabled")]
public string PublicNetworkAccess { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Additional authentication requirements when exporting or uploading to a disk or snapshot.")]
[PSArgumentCompleter("AzureActiveDirectory", "None")]
public string DataAccessAuthMode { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "CPU architecture supported by an OS disk. Possible values are \"X64\" and \"Arm64\".")]
[PSArgumentCompleter("X64", "Arm64")]
public string Architecture { get; set; }

protected override void ProcessRecord()
{
if (ShouldProcess("SnapshotUpdate", "New"))
Expand All @@ -120,6 +134,8 @@ private void Run()
// Sku
SnapshotSku vSku = null;

SupportedCapabilities vSupportedCapabilities = null;

if (this.IsParameterBound(c => c.EncryptionSettingsEnabled))
{
if (vEncryptionSettingsCollection == null)
Expand Down Expand Up @@ -193,6 +209,15 @@ private void Run()
vSku.Name = this.SkuName;
}

if (this.IsParameterBound(c => c.Architecture))
{
if (vSupportedCapabilities == null)
{
vSupportedCapabilities = new SupportedCapabilities();
}
vSupportedCapabilities.Architecture = this.Architecture;
}

var vSnapshotUpdate = new PSSnapshotUpdate
{
OsType = this.IsParameterBound(c => c.OsType) ? this.OsType : (OperatingSystemTypes?)null,
Expand All @@ -202,7 +227,9 @@ private void Run()
Encryption = vEncryption,
Sku = vSku,
SupportsHibernation = this.IsParameterBound(c => c.SupportsHibernation) ? SupportsHibernation : null,
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null,
DataAccessAuthMode = this.IsParameterBound(c => c.DataAccessAuthMode) ? DataAccessAuthMode : null,
SupportedCapabilities = vSupportedCapabilities
};

WriteObject(vSnapshotUpdate);
Expand Down
2 changes: 2 additions & 0 deletions src/Compute/Compute/Models/PSVirtualMachineImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,7 @@ public string DataDiskImagesText
}

public AutomaticOSUpgradeProperties AutomaticOSUpgradeProperties { get; set; }

public string Architecture { get; set; }
}
}
6 changes: 3 additions & 3 deletions src/Compute/Compute/StorageServices/AddAzureVhdCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class AddAzureVhdCommand : ComputeClientBaseCmdlet
public string DiskName { get; set; }

[Parameter(
Mandatory = true,
Mandatory = true,
Position = 1,
ParameterSetName = DirectUploadToManagedDiskSet,
ValueFromPipelineByPropertyName = true,
Expand Down Expand Up @@ -461,7 +461,7 @@ private void CheckForInvalidVhd()
try
{
bool resizeNeeded = false;
long resizeTo=0;
long resizeTo = 0;
using (VirtualDiskStream vds = new VirtualDiskStream(filePath.FullName))
{
if (vds.Length < 20971520 || vds.Length > 4396972769280)
Expand Down Expand Up @@ -640,4 +640,4 @@ private void resizeVhdFile(long FileSize)
}
}
}
}
}
34 changes: 32 additions & 2 deletions src/Compute/Compute/help/New-AzDiskConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ New-AzDiskConfig [[-SkuName] <String>] [-Tier <String>] [-LogicalSectorSize <Int
[-DiskEncryptionKey <KeyVaultAndSecretReference>] [-KeyEncryptionKey <KeyVaultAndKeyReference>]
[-DiskEncryptionSetId <String>] [-EncryptionType <String>] [-DiskAccessId <String>]
[-NetworkAccessPolicy <String>] [-BurstingEnabled <Boolean>] [-PublicNetworkAccess <String>]
[-AcceleratedNetwork <Boolean>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
[-AcceleratedNetwork <Boolean>] [-DataAccessAuthMode <String>] [-Architecture <String>] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -97,6 +97,21 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -Architecture
CPU architecture supported by an OS disk. Possible values are "X64" and "Arm64".
```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -BurstingEnabled
Enables bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks.
Expand Down Expand Up @@ -128,6 +143,21 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -DataAccessAuthMode
Additional authentication requirements when exporting or uploading to a disk or snapshot.
```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Expand Down
Loading

0 comments on commit e6a6ae8

Please sign in to comment.