Skip to content

Commit 4814eef

Browse files
committed
Update PSVirtualMachine models to use APAE Param, updated NewAzvm cmdlet to allow Param
1 parent 526e43b commit 4814eef

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

src/Compute/Compute/Manual/PSVirtualMachineScaleSet.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ public partial class PSVirtualMachineScaleSet
2020
{
2121
// Gets or sets the FQDN.
2222
public string FullyQualifiedDomainName { get; set; }
23+
24+
//Gets or sets AddProxyAgentExtension.
25+
public bool? AddProxyAgentExtension { get; set; }
2326
}
2427
}

src/Compute/Compute/Models/PSVirtualMachine.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,8 @@ public string ResourceGroupName
157157
public string Etag { get; private set; }
158158

159159
public Placement Placement { get; set; }
160+
161+
// Gets or sets the AddProxyAgentExtension
162+
public bool? AddProxyAgentExtension { get; set; }
160163
}
161164
}

src/Compute/Compute/Strategies/ComputeRp/VirtualMachineStrategy.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ public static ResourceConfig<VirtualMachine> CreateVirtualMachineConfig(
8585
string[] includeZone = null,
8686
string[] excludeZone = null,
8787
bool? alignRegionalDisksToVMZone = null,
88-
bool? enableProxyAgent = null
88+
bool? enableProxyAgent = null,
89+
bool? addProxyAgentExtension = null
8990
)
9091
=> Strategy.CreateResourceConfig(
9192
resourceGroup: resourceGroup,
@@ -163,7 +164,7 @@ public static ResourceConfig<VirtualMachine> CreateVirtualMachineConfig(
163164
EncryptionAtHost = encryptionAtHostPresent,
164165
UefiSettings = (enableVtpm != null || enableSecureBoot != null) ? new UefiSettings(enableSecureBoot, enableVtpm) : null,
165166
SecurityType = securityType,
166-
ProxyAgentSettings = enableProxyAgent == true ? new ProxyAgentSettings(enableProxyAgent) : null,
167+
ProxyAgentSettings = (enableProxyAgent == true || addProxyAgentExtension == true) ? new ProxyAgentSettings(enableProxyAgent) { AddProxyAgentExtension = addProxyAgentExtension } : null,
167168
},
168169
CapacityReservation = string.IsNullOrEmpty(capacityReservationGroupId) ? null : new CapacityReservationProfile
169170
{

src/Compute/Compute/VirtualMachine/Operation/NewAzureVMCommand.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,13 @@ public class NewAzureVMCommand : VirtualMachineBaseCmdlet
497497
HelpMessage = "Specifies whether Metadata Security Protocol(ProxyAgent) feature should be enabled or not.")]
498498
public SwitchParameter EnableProxyAgent { get; set; }
499499

500+
[Parameter(
501+
Mandatory = false,
502+
ValueFromPipelineByPropertyName = true,
503+
ParameterSetName = SimpleParameterSet,
504+
HelpMessage = "Specifies whether to add installation of the ProxyAgent extension.")]
505+
public SwitchParameter AddProxyAgentExtension { get; set; }
506+
500507
public override void ExecuteCmdlet()
501508
{
502509

@@ -749,7 +756,8 @@ public async Task<ResourceConfig<VirtualMachine>> CreateConfigAsync()
749756
includeZone: _cmdlet.IncludeZone,
750757
excludeZone: _cmdlet.ExcludeZone,
751758
alignRegionalDisksToVMZone: _cmdlet.AlignRegionalDisksToVMZone,
752-
enableProxyAgent: _cmdlet.EnableProxyAgent ? true : (bool?)null
759+
enableProxyAgent: _cmdlet.EnableProxyAgent ? true : (bool?)null,
760+
addProxyAgentExtension: _cmdlet.AddProxyAgentExtension ? true : (bool?)null
753761
);
754762
}
755763
else // does not get used. DiskFile parameter set is not supported.

0 commit comments

Comments
 (0)