Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/agents/ps-cmdlet.agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
name: PowerShell Pull Request Agent
description: Specialized agent for creating PowerShell pull requests based on a design request
---

The user is going to ask you to implement a new feature in existing C# code for a Powershell cmdlet. You will write tests, make code changes, add help docs, and add changelog.
You are an engineering assistant helping Azure PowerShell contributors update or add parameters to Compute cmdlets. Your job is to accurately locate the cmdlet implementation, modify parameters and execution flow, apply PowerShell/ComputeRP conventions, and produce all required artifacts (code, docs, tests, and changelog). Prioritize correctness, least-risk edits, and traceability.

# Scope
- Module: Azure PowerShell Compute
- Cmdlet files live under `src/Compute/Compute/**`
- You will read and reason about C# cmdlet sources, strategy classes, model classes, and test assets

# Objectives
1) Identify the correct cmdlet file and confirm the cmdlet mapping.
2) Add or modify parameters with proper metadata and mapping.
3) Update all required files (code, help, tests, changelog).

# Ground Truth & Location Rules
- Primary cmdlet implementation: `src/Compute/Compute/…/<command>.cs`
- Example: `New-AzVM` → `NewAzureVMCommand.cs`
- Confirm mapping via `[Cmdlet("Verb", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Noun", ...)]`
- Example: `[Cmdlet("New", AzureRMPrefix + "VM", …)]` ⇒ `New-AzVM`
- Related execution may be in associated strategy files (e.g., `VirtualMachineStrategy.cs`)
- Model classes representing Swagger schema live in: `src/Compute/Compute/Models/<command>.cs`

# Parameter Authoring Rules
- Parameters are usually declared at the top of the cmdlet C# file.
- Parameters have metadata that may specify parameter sets or `Mandatory` status.
- **Mapping requirement:** Variables in **PowerShell objects must have a `set`** method to be bound from parameters. Follow the structure of existing parameters
- Keep parameter names, types, and sets consistent with the cmdlet design

# Execution Flow Rules
- `ExecuteCmdlet()` implements logic per **parameter set** (usually via `switch`).
- `DefaultExecuteCmdlet()` handles **DefaultParameterSet**.
- Additional methods (e.g., `CreateConfigAsync()`) may be invoked directly or via a `*Strategy` file.
- **Editing a parameter set requires updating the full call stack**:
- For DefaultParameterSet ⇒ adjust `DefaultExecuteCmdlet()` path.
- For other sets ⇒ adjust their specific methods and any strategy indirections.
- Not all files will have these methods or follow this format, so use the existing patterns when adding new parameters.

# Built-in Utilities (apply exactly)
- Determine if a value was passed:
- `IsParameterBound(c => c.<ParameterName>)`

- If required details are missing, make a comment and request clarification from the owning team.

# Required Artifacts to Update
1) **Changelog**
- `src/Compute/Compute/ChangeLog.md`
- Describe customer-visible changes (new parameter, behavior change, etc.).
2) **Model Class** (Swagger mapping)
- `src/Compute/Compute/Models/<model>.cs`
- Add/adjust properties to represent the API schema.
3) **Cmdlet Implementation**
- `src/Compute/Compute/<usually Generated or Manual or Strategies>/…/<command>.cs`
- Add/modify parameters, validation, binding, and execution paths.
- If code is split, also update related files (e.g., `NewAzureVMCommand.cs`, `VirtualMachineStrategy.cs`).
4) **Help Content**
- `src/Compute/Compute/help/<command>.md`
- Regenerate using the module's help script: Update-MarkdownHelp -Path ./src/Compute/Compute/help/New-AzVM.md -AlphabeticParamsOrder -UseFullTypeName
- Ensure examples cover new parameters.
5) **Tests**
- PowerShell scenario test: `src/Compute/Compute.Test/ScenarioTests/<command>.ps1`
- C# test reference: `src/Compute/Compute.Test/ScenarioTests/<command>.cs`
- Add cases for: presence/absence of the new parameter, parameter set routing, validation, and expected side effects. Use existing tests for reference on how to create new tests.

# Quality & Safety Checklist (enforce before finalizing)
- Cmdlet attribute matches `<Verb>-Az<Noun>` and correct parameter sets.
- New/changed parameters have clear `Parameter` metadata (sets, `Mandatory`, `HelpMessage` if applicable).
- `ExecuteCmdlet()` routes correctly; Default vs non-default paths updated.
- `IsParameterBound` used to detect passed values; no reliance on null for "not provided".
- Help regenerated and examples verified.
- Scenario tests cover success/failure paths.
- `ChangeLog.md` describes customer-visible impact.
14 changes: 14 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,19 @@ public void SimpleNewVmssSkipExtOverprovision()
{
TestRunner.RunTestScript("Test-SimpleNewVmssSkipExtOverprovision");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSimpleNewVmssWithHighSpeedInterconnect()
{
TestRunner.RunTestScript("Test-SimpleNewVmssWithHighSpeedInterconnect");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewVmssConfigWithHighSpeedInterconnect()
{
TestRunner.RunTestScript("Test-NewVmssConfigWithHighSpeedInterconnect");
}
}
}
55 changes: 55 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -551,3 +551,58 @@ function Test-SimpleNewVmssSkipExtOverprovision
Clean-ResourceGroup $vmssname
}
}

<#
.SYNOPSIS
Test HighSpeedInterconnectPlacement parameter for New-AzVmss
#>
function Test-SimpleNewVmssWithHighSpeedInterconnect
{
# Setup
$vmssname = Get-ResourceName

try
{
$username = "admin01"
$password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
[string]$domainNameLabel = "$vmssname$vmssname".tolower();
$stnd = "Standard";

# Test with HighSpeedInterconnectPlacement = Trunk
New-AzVmss -Name $vmssname -Location "westus2" -Credential $cred -DomainNameLabel $domainNameLabel -SecurityType $stnd `
-HighSpeedInterconnectPlacement "Trunk";
$vmss = Get-AzVmss -ResourceGroupName $vmssname -Name $vmssname;
Assert-AreEqual "Trunk" $vmss.HighSpeedInterconnectPlacement;
}
finally
{
# Cleanup
Clean-ResourceGroup $vmssname
}
}

<#
.SYNOPSIS
Test HighSpeedInterconnectPlacement parameter for New-AzVmssConfig
#>
function Test-NewVmssConfigWithHighSpeedInterconnect
{
# Setup
$vmssname = Get-ResourceName

try
{
# Test with HighSpeedInterconnectPlacement = None
$vmssConfig = New-AzVmssConfig -Location "westus2" -HighSpeedInterconnectPlacement "None";
Assert-AreEqual "None" $vmssConfig.HighSpeedInterconnectPlacement;

# Test with HighSpeedInterconnectPlacement = Trunk
$vmssConfig2 = New-AzVmssConfig -Location "westus2" -HighSpeedInterconnectPlacement "Trunk";
Assert-AreEqual "Trunk" $vmssConfig2.HighSpeedInterconnectPlacement;
}
finally
{
# No cleanup needed for config tests
}
}
4 changes: 4 additions & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

-->
## Upcoming Release
* Added `HighSpeedInterconnectPlacement` parameter to `New-AzVmss` and `New-AzVmssConfig` cmdlets
- Allows customers to enable or disable Infiniband network interconnect for RDMA VM sizes (Virtual Machine Scale Sets)
- Supported values: 'None' and 'Trunk'
- Requires API version 2025-04-01 or higher

## Version 11.0.0
* Improved user experience and consistency. This may introduce breaking changes. Please refer to [here](https://go.microsoft.com/fwlink/?linkid=2340249).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ public string ResourceGroupName
public string Etag { get; private set; }

public ResiliencyPolicy ResiliencyPolicy { get; set; }
public string HighSpeedInterconnectPlacement { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ public partial class NewAzureRmVmssConfigCommand : Microsoft.Azure.Commands.Reso
[PSArgumentCompleter("CreateBeforeDelete")]
public string AutomaticZoneRebalanceBehavior { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Specifies the high speed interconnect placement for the virtual machine scale set. Possible values are 'None' and 'Trunk'.")]
[PSArgumentCompleter("None", "Trunk")]
public string HighSpeedInterconnectPlacement { get; set; }

protected override void ProcessRecord()
{
if (ShouldProcess("VirtualMachineScaleSet", "New"))
Expand Down Expand Up @@ -1145,7 +1152,8 @@ private void Run()
SpotRestorePolicy = this.IsParameterBound(c => c.EnableSpotRestore) ? new SpotRestorePolicy(true, this.SpotRestoreTimeout) : null,
PriorityMixPolicy = vPriorityMixPolicy,
SkuProfile = vSkuProfile,
ResiliencyPolicy = vResiliencyPolicy
ResiliencyPolicy = vResiliencyPolicy,
HighSpeedInterconnectPlacement = this.IsParameterBound(c => c.HighSpeedInterconnectPlacement) ? this.HighSpeedInterconnectPlacement : null
};

WriteObject(vVirtualMachineScaleSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,14 @@ public partial class NewAzureRmVmss : ComputeAutomationBaseCmdlet
HelpMessage = "Specify whether to implicitly install the ProxyAgent Extension. This option is currently applicable only for Linux Os.")]
public SwitchParameter AddProxyAgentExtension { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
ParameterSetName = SimpleParameterSet,
HelpMessage = "Specifies the high speed interconnect placement for the virtual machine scale set. Possible values are 'None' and 'Trunk'.")]
[PSArgumentCompleter("None", "Trunk")]
public string HighSpeedInterconnectPlacement { get; set; }

private void ConfigureSecuritySettings()
{
if (SecurityType?.ToLower() == SecurityTypes.TrustedLaunch ||
Expand Down Expand Up @@ -560,7 +568,8 @@ private async Task<ResourceConfig<VirtualMachineScaleSet>> SimpleParameterSetNor
securityPostureId: _cmdlet.SecurityPostureId,
securityPostureExcludeExtension: _cmdlet.SecurityPostureExcludeExtension,
enableProxyAgent: _cmdlet.EnableProxyAgent ? true : (bool?)null,
addProxyAgentExtension: _cmdlet.AddProxyAgentExtension.IsPresent ? true : (bool?)null
addProxyAgentExtension: _cmdlet.AddProxyAgentExtension.IsPresent ? true : (bool?)null,
highSpeedInterconnectPlacement: _cmdlet.IsParameterBound(c => c.HighSpeedInterconnectPlacement) ? _cmdlet.HighSpeedInterconnectPlacement : null
);
}

Expand Down Expand Up @@ -701,7 +710,8 @@ private async Task<ResourceConfig<VirtualMachineScaleSet>> SimpleParameterSetOrc
securityPostureId: _cmdlet.SecurityPostureId,
securityPostureExcludeExtension: _cmdlet.SecurityPostureExcludeExtension,
enableProxyAgent: _cmdlet.EnableProxyAgent ? true : (bool?)null,
addProxyAgentExtension: _cmdlet.AddProxyAgentExtension.IsPresent ? true : (bool?)null
addProxyAgentExtension: _cmdlet.AddProxyAgentExtension.IsPresent ? true : (bool?)null,
highSpeedInterconnectPlacement: _cmdlet.IsParameterBound(c => c.HighSpeedInterconnectPlacement) ? _cmdlet.HighSpeedInterconnectPlacement : null
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ internal static ResourceConfig<VirtualMachineScaleSet> CreateVirtualMachineScale
string securityPostureId = null,
string[] securityPostureExcludeExtension = null,
bool? enableProxyAgent = null,
bool? addProxyAgentExtension = null
bool? addProxyAgentExtension = null,
string highSpeedInterconnectPlacement = null
)
=> Strategy.CreateResourceConfig(
resourceGroup: resourceGroup,
Expand Down Expand Up @@ -201,7 +202,8 @@ internal static ResourceConfig<VirtualMachineScaleSet> CreateVirtualMachineScale
AllocationStrategy = skuProfileAllocationStrategy
},
DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs ? true : (bool?)null,
OrchestrationMode = orchestrationMode
OrchestrationMode = orchestrationMode,
HighSpeedInterconnectPlacement = highSpeedInterconnectPlacement
};
if (auxAuthHeader != null)
{
Expand Down Expand Up @@ -254,7 +256,8 @@ internal static ResourceConfig<VirtualMachineScaleSet> CreateVirtualMachineScale
string securityPostureId = null,
string[] securityPostureExcludeExtension = null,
bool? enableProxyAgent = null,
bool? addProxyAgentExtension = null
bool? addProxyAgentExtension = null,
string highSpeedInterconnectPlacement = null
)
=> Strategy.CreateResourceConfig(
resourceGroup: resourceGroup,
Expand Down Expand Up @@ -353,7 +356,8 @@ internal static ResourceConfig<VirtualMachineScaleSet> CreateVirtualMachineScale
AllocationStrategy = skuProfileAllocationStrategy
},
DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs ? true : (bool?)null,
OrchestrationMode = orchestrationMode
OrchestrationMode = orchestrationMode,
HighSpeedInterconnectPlacement = highSpeedInterconnectPlacement
};
if (auxAuthHeader != null)
{
Expand Down
20 changes: 19 additions & 1 deletion src/Compute/Compute/help/New-AzVmss.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ New-AzVmss [[-ResourceGroupName] <String>] [-VMScaleSetName] <String> [-AsJob] [
[-BackendPoolName <String>] [-SystemAssignedIdentity] [-UserAssignedIdentity <String>] [-EnableUltraSSD]
[-Zone <System.Collections.Generic.List`1[System.String]>] [-NatBackendPort <Int32[]>]
[-DataDiskSizeInGb <Int32[]>] [-ProximityPlacementGroupId <String>] [-HostGroupId <String>]
[-Priority <String>] [-EvictionPolicy <String>] [-MaxPrice <Double>] [-ScaleInPolicy <String[]>]
[-HighSpeedInterconnectPlacement <String>] [-Priority <String>] [-EvictionPolicy <String>]
[-MaxPrice <Double>] [-ScaleInPolicy <String[]>]
[-SkipExtensionsOnOverprovisionedVMs] [-EncryptionAtHost] [-PlatformFaultDomainCount <Int32>]
[-OrchestrationMode <String>] [-CapacityReservationGroupId <String>] [-ImageReferenceId <String>]
[-DiskControllerType <String>] [-SharedGalleryImageId <String>] [-SecurityType <String>]
Expand Down Expand Up @@ -618,6 +619,23 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -HighSpeedInterconnectPlacement
Specifies the high speed interconnect placement for the virtual machine scale set. This property allows customers to enable or disable Infiniband network interconnect for RDMA VM sizes. Possible values are:
- None: No high speed interconnect placement
- Trunk: Trunk high speed interconnect placement

```yaml
Type: System.String
Parameter Sets: SimpleParameterSet
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -IfMatch
used to make a request conditional for the PUT and other non-safe methods. The server will only return the requested resources if the resource matches one of the listed ETag values. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes.

Expand Down
23 changes: 21 additions & 2 deletions src/Compute/Compute/help/New-AzVmssConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ New-AzVmssConfig [[-Overprovision] <Boolean>] [[-Location] <String>] [-EdgeZone
[-PlanName <String>] [-PlanPublisher <String>] [-PlanProduct <String>] [-PlanPromotionCode <String>]
[-RollingUpgradePolicy <RollingUpgradePolicy>] [-EnableAutomaticRepair] [-AutomaticRepairGracePeriod <String>]
[-EnableAutomaticOSUpgrade] [-DisableAutoRollback <Boolean>] [-EnableUltraSSD] [-HealthProbeId <String>]
[-BootDiagnostic <BootDiagnostics>] [-LicenseType <String>] [-Priority <String>] [-EnableSpotRestore]
[-HighSpeedInterconnectPlacement <String>] [-BootDiagnostic <BootDiagnostics>] [-LicenseType <String>]
[-Priority <String>] [-EnableSpotRestore]
[-SpotRestoreTimeout <String>] [-EvictionPolicy <String>] [-MaxPrice <Double>] [-TerminateScheduledEvents]
[-TerminateScheduledEventNotBeforeTimeoutInMinutes <Int32>] [-ProximityPlacementGroupId <String>]
[-ScaleInPolicy <String[]>] [-EncryptionAtHost] [-OrchestrationMode <String>]
Expand All @@ -50,7 +51,8 @@ New-AzVmssConfig [[-Overprovision] <Boolean>] [[-Location] <String>] [-EdgeZone
[-PlanName <String>] [-PlanPublisher <String>] [-PlanProduct <String>] [-PlanPromotionCode <String>]
[-RollingUpgradePolicy <RollingUpgradePolicy>] [-EnableAutomaticRepair] [-AutomaticRepairGracePeriod <String>]
[-EnableAutomaticOSUpgrade] [-DisableAutoRollback <Boolean>] [-EnableUltraSSD] [-HealthProbeId <String>]
[-BootDiagnostic <BootDiagnostics>] [-LicenseType <String>] [-Priority <String>] [-EnableSpotRestore]
[-HighSpeedInterconnectPlacement <String>] [-BootDiagnostic <BootDiagnostics>] [-LicenseType <String>]
[-Priority <String>] [-EnableSpotRestore]
[-SpotRestoreTimeout <String>] [-EvictionPolicy <String>] [-MaxPrice <Double>] [-TerminateScheduledEvents]
[-TerminateScheduledEventNotBeforeTimeoutInMinutes <Int32>] [-ProximityPlacementGroupId <String>]
[-ScaleInPolicy <String[]>] -IdentityType <ResourceIdentityType> [-IdentityId <String[]>]
Expand Down Expand Up @@ -587,6 +589,23 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -HighSpeedInterconnectPlacement
Specifies the high speed interconnect placement for the virtual machine scale set. This property allows customers to enable or disable Infiniband network interconnect for RDMA VM sizes. Possible values are:
- None: No high speed interconnect placement
- Trunk: Trunk high speed interconnect placement

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -IdentityId
Specifies the list of user identities associated with the virtual machine scale set.
The user identity references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'
Expand Down