Skip to content

Commit e7b8380

Browse files
Add -VcfLicense parameter to New-AzVMwarePrivateCloud (#29765)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e95c6ea commit e7b8380

4 files changed

Lines changed: 99 additions & 1 deletion

File tree

src/VMware/VMware.Autorest/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,26 @@ directive:
152152
verb: Update
153153
subject: HcxEnterpriseSite|ScriptExecution|Addon
154154
remove: true
155+
# Prevent flattening of discriminated union types — these must be passed as full objects.
156+
# AddonProperties and PlacementPolicyProperties are polymorphic base types whose subtypes
157+
# are constructed via dedicated New-AzVMware*Object cmdlets.
158+
# VcfLicense is a discriminated union type (base: VcfLicense, concrete: Vcf5License).
159+
# AutoRest cannot safely flatten it, so we keep it as a single -VcfLicense parameter.
155160
- no-inline:
156161
- AddonProperties
157162
- PlacementPolicyProperties
158-
# Re-name and custom it
163+
- VcfLicense
164+
# Generate helper object cmdlets for model types that are discriminated unions and
165+
# cannot be flattened into individual cmdlet parameters.
159166
- model-cmdlet:
160167
- model-name: VMPlacementPolicyProperties
161168
cmdlet-name: New-AzVMwareVMPlacementPolicyPropertyObject
162169
- model-name: VmHostPlacementPolicyProperties
163170
cmdlet-name: New-AzVMwareVmHostPlacementPolicyPropertyObject
171+
# Vcf5License is the only concrete subtype of VcfLicense in the 2025-09-01 API.
172+
# The helper cmdlet constructs a Vcf5License object for use with New-AzVMwarePrivateCloud -VcfLicense.
173+
- model-name: Vcf5License
174+
cmdlet-name: New-AzVMwareVcf5LicenseObject
164175
# - model-name: ScriptSecureStringExecutionParameter
165176
# - model-name: ScriptStringExecutionParameter
166177
# - model-name: PSCredentialExecutionParameter

src/VMware/VMware.Autorest/custom/New-AzVMwarePrivateCloud.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ IDENTITYSOURCE <IIdentitySource[]>: vCenter Single Sign On Identity Sources
4646
[SecondaryServer <String>]: Secondary server URL
4747
[Ssl <String?>]: Protect LDAP communication using SSL certificate (LDAPS)
4848
[Username <String>]: The ID of an Active Directory user with a minimum of read-only access to Base DN for users and group
49+
50+
VCFLICENSE <IVcfLicense>: The VMware Cloud Foundation (VCF) license for the private cloud. Use New-AzVMwareVcf5LicenseObject to create the license object.
51+
[Kind <String>]: License kind (e.g. vcf5)
4952
.Link
5053
https://learn.microsoft.com/powershell/module/az.vmware/new-azvmwareprivatecloud
5154
#>
@@ -202,6 +205,14 @@ function New-AzVMwarePrivateCloud {
202205
# Optionally, set the vCenter admin password when the private cloud is created
203206
${VcenterPassword},
204207

208+
[Parameter()]
209+
[Microsoft.Azure.PowerShell.Cmdlets.VMware.Category('Body')]
210+
[Microsoft.Azure.PowerShell.Cmdlets.VMware.Models.IVcfLicense]
211+
# The VMware Cloud Foundation (VCF) license for the private cloud.
212+
# To construct, see NOTES section for VCFLICENSE properties and create a hash table,
213+
# or use New-AzVMwareVcf5LicenseObject to create a Vcf5License object.
214+
${VcfLicense},
215+
205216
[Parameter()]
206217
[System.Management.Automation.SwitchParameter]
207218
# Accept EULA of AVS, legal term will pop up without this parameter provided
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
# ----------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
14+
# is regenerated.
15+
# ----------------------------------------------------------------------------------
16+
17+
<#
18+
.Synopsis
19+
Create an in-memory object for Vcf5License.
20+
.Description
21+
Create an in-memory object for a VMware Cloud Foundation (VCF) 5.0 license, to be passed to New-AzVMwarePrivateCloud via the -VcfLicense parameter.
22+
.Example
23+
$license = New-AzVMwareVcf5LicenseObject -Core 16 -EndDate (Get-Date "2027-01-01") -LicenseKey "12345-12345-12345-12345-12345" -BroadcomSiteId "site123" -BroadcomContractNumber "contract123"
24+
New-AzVMwarePrivateCloud -Name mycloud -ResourceGroupName myrg -Location eastus -Sku av36 -ManagementClusterSize 3 -NetworkBlock 192.168.48.0/22 -VcfLicense $license -AcceptEULA
25+
26+
.Outputs
27+
Microsoft.Azure.PowerShell.Cmdlets.VMware.Models.Vcf5License
28+
.Link
29+
https://learn.microsoft.com/powershell/module/Az.VMware/new-azvmwarevcf5licenseobject
30+
#>
31+
function New-AzVMwareVcf5LicenseObject {
32+
[Microsoft.Azure.PowerShell.Cmdlets.VMware.ModelCmdletAttribute()]
33+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.VMware.Models.Vcf5License')]
34+
[CmdletBinding(PositionalBinding=$false)]
35+
Param(
36+
[Parameter(Mandatory, HelpMessage="Number of cores included in the license.")]
37+
[int]
38+
$Core,
39+
40+
[Parameter(Mandatory, HelpMessage="UTC datetime when the license expires.")]
41+
[System.DateTime]
42+
$EndDate,
43+
44+
[Parameter(HelpMessage="License key.")]
45+
[System.Security.SecureString]
46+
$LicenseKey,
47+
48+
[Parameter(HelpMessage="The Broadcom site ID associated with the license.")]
49+
[string]
50+
$BroadcomSiteId,
51+
52+
[Parameter(HelpMessage="The Broadcom contract number associated with the license.")]
53+
[string]
54+
$BroadcomContractNumber
55+
)
56+
57+
process {
58+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.VMware.Models.Vcf5License]::New()
59+
60+
$Object.Core = $Core
61+
$Object.EndDate = $EndDate
62+
63+
if ($PSBoundParameters.ContainsKey('LicenseKey')) {
64+
$Object.LicenseKey = $LicenseKey
65+
}
66+
if ($PSBoundParameters.ContainsKey('BroadcomSiteId')) {
67+
$Object.BroadcomSiteId = $BroadcomSiteId
68+
}
69+
if ($PSBoundParameters.ContainsKey('BroadcomContractNumber')) {
70+
$Object.BroadcomContractNumber = $BroadcomContractNumber
71+
}
72+
return $Object
73+
}
74+
}

src/VMware/VMware/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Added `-VcfLicense` parameter to `New-AzVMwarePrivateCloud` to support setting a VMware Cloud Foundation (VCF) license during private cloud provisioning
22+
- Added `New-AzVMwareVcf5LicenseObject` helper cmdlet to construct a VCF 5.0 license object for use with `-VcfLicense`
2123

2224
## Version 0.9.0
2325
* Updated the AVS VMware cmdlets api version to `2025-09-01`.

0 commit comments

Comments
 (0)