diff --git a/Registration/RegisterWithAzure.psm1 b/Registration/RegisterWithAzure.psm1 index a924b381..b0bc9c5f 100644 --- a/Registration/RegisterWithAzure.psm1 +++ b/Registration/RegisterWithAzure.psm1 @@ -181,18 +181,25 @@ function Set-AzsRegistration{ 'CustomCloud'='westcentralus'}[$AzureContext.Environment.Name], [Parameter(Mandatory = $false)] - [ValidateSet('Capacity', 'PayAsYouUse', 'Development')] + [ValidateSet('Capacity', 'PayAsYouUse', 'Development','Custom')] [string] $BillingModel = 'Development', [Parameter(Mandatory = $false)] [switch] $MarketplaceSyndicationEnabled = $true, [Parameter(Mandatory = $false)] - [switch] $UsageReportingEnabled = $true, + [switch] $UsageReportingEnabled = @{'Capacity'=$true; + 'PayAsYouUse'=$true; + 'Development'=$true; + 'Custom'=$false}[$BillingModel], [Parameter(Mandatory = $false)] [ValidateNotNull()] - [string] $AgreementNumber + [string] $AgreementNumber, + + [Parameter(Mandatory=$false)] + [ValidateNotNull()] + [string] $MsAssetTag ) #requires -Version 4.0 #requires -Modules @{ModuleName = "AzureRM.Profile" ; ModuleVersion = "1.0.4.4"} @@ -222,6 +229,7 @@ function Set-AzsRegistration{ MarketplaceSyndicationEnabled = $MarketplaceSyndicationEnabled UsageReportingEnabled = $UsageReportingEnabled AgreementNumber = $AgreementNumber + MsAssetTag = $MsAssetTag } Log-Output "Get-RegistrationToken parameters: $(ConvertTo-Json $getTokenParams)" if (($BillingModel -eq 'Capacity') -and ($UsageReportingEnabled)) @@ -456,7 +464,7 @@ Function Get-AzsRegistrationToken{ [String] $PrivilegedEndpoint, [Parameter(Mandatory = $true)] - [ValidateSet('Capacity', 'Development')] + [ValidateSet('Capacity', 'Development','Custom')] [string] $BillingModel = 'Capacity', [Parameter(Mandatory = $false)] @@ -471,7 +479,11 @@ Function Get-AzsRegistrationToken{ [Parameter(Mandatory = $false)] [ValidateNotNull()] - [string] $AgreementNumber + [string] $AgreementNumber, + + [Parameter(Mandatory=$false)] + [ValidateNotNull()] + [string] $MsAssetTag ) #requires -Version 4.0 #requires -RunAsAdministrator @@ -516,6 +528,7 @@ Function Get-AzsRegistrationToken{ UsageReportingEnabled = $UsageReportingEnabled AgreementNumber = $AgreementNumber TokenOutputFilePath = $TokenOutputFilePath + MsAssetTag = $MsAssetTag } Log-Output "Registration action params: $(ConvertTo-Json $params)" @@ -1046,7 +1059,7 @@ Function Get-RegistrationToken{ [String] $PrivilegedEndpoint, [Parameter(Mandatory = $false)] - [ValidateSet('Capacity', 'PayAsYouUse', 'Development')] + [ValidateSet('Capacity', 'PayAsYouUse', 'Development','Custom')] [string] $BillingModel = 'Development', [Parameter(Mandatory = $false)] @@ -1066,7 +1079,11 @@ Function Get-RegistrationToken{ [PSObject] $StampInfo, [Parameter(Mandatory = $false)] - [String] $TokenOutputFilePath + [String] $TokenOutputFilePath, + + [Parameter(Mandatory=$false)] + [ValidateNotNull()] + [string] $MsAssetTag ) if (-not $StampInfo) @@ -1082,7 +1099,7 @@ Function Get-RegistrationToken{ try { Log-Output "Creating registration token. Attempt $currentAttempt of $maxAttempt" - $registrationToken = Invoke-Command -Session $session -ScriptBlock { New-RegistrationToken -BillingModel $using:BillingModel -MarketplaceSyndicationEnabled:$using:MarketplaceSyndicationEnabled -UsageReportingEnabled:$using:UsageReportingEnabled -AgreementNumber $using:AgreementNumber } + $registrationToken = Invoke-Command -Session $session -ScriptBlock { New-RegistrationToken -BillingModel $using:BillingModel -MarketplaceSyndicationEnabled:$using:MarketplaceSyndicationEnabled -UsageReportingEnabled:$using:UsageReportingEnabled -AgreementNumber $using:AgreementNumber -MsAssetTag $using:MsAssetTag } if ($TokenOutputFilePath) { Log-Output "Registration token will be written to: $TokenOutputFilePath"