Skip to content

Commit fef83f7

Browse files
authored
Merge pull request #536 from Azure/user/rakku/custombilling-m
Custombilling registration
2 parents 8a9106a + 1baf459 commit fef83f7

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

Registration/RegisterWithAzure.psm1

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,25 @@ function Set-AzsRegistration{
181181
'CustomCloud'='westcentralus'}[$AzureContext.Environment.Name],
182182

183183
[Parameter(Mandatory = $false)]
184-
[ValidateSet('Capacity', 'PayAsYouUse', 'Development')]
184+
[ValidateSet('Capacity', 'PayAsYouUse', 'Development','Custom')]
185185
[string] $BillingModel = 'Development',
186186

187187
[Parameter(Mandatory = $false)]
188188
[switch] $MarketplaceSyndicationEnabled = $true,
189189

190190
[Parameter(Mandatory = $false)]
191-
[switch] $UsageReportingEnabled = $true,
191+
[switch] $UsageReportingEnabled = @{'Capacity'=$true;
192+
'PayAsYouUse'=$true;
193+
'Development'=$true;
194+
'Custom'=$false}[$BillingModel],
192195

193196
[Parameter(Mandatory = $false)]
194197
[ValidateNotNull()]
195-
[string] $AgreementNumber
198+
[string] $AgreementNumber,
199+
200+
[Parameter(Mandatory=$false)]
201+
[ValidateNotNull()]
202+
[string] $MsAssetTag
196203
)
197204
#requires -Version 4.0
198205
#requires -Modules @{ModuleName = "AzureRM.Profile" ; ModuleVersion = "1.0.4.4"}
@@ -222,6 +229,7 @@ function Set-AzsRegistration{
222229
MarketplaceSyndicationEnabled = $MarketplaceSyndicationEnabled
223230
UsageReportingEnabled = $UsageReportingEnabled
224231
AgreementNumber = $AgreementNumber
232+
MsAssetTag = $MsAssetTag
225233
}
226234
Log-Output "Get-RegistrationToken parameters: $(ConvertTo-Json $getTokenParams)"
227235
if (($BillingModel -eq 'Capacity') -and ($UsageReportingEnabled))
@@ -456,7 +464,7 @@ Function Get-AzsRegistrationToken{
456464
[String] $PrivilegedEndpoint,
457465

458466
[Parameter(Mandatory = $true)]
459-
[ValidateSet('Capacity', 'Development')]
467+
[ValidateSet('Capacity', 'Development','Custom')]
460468
[string] $BillingModel = 'Capacity',
461469

462470
[Parameter(Mandatory = $false)]
@@ -471,7 +479,11 @@ Function Get-AzsRegistrationToken{
471479

472480
[Parameter(Mandatory = $false)]
473481
[ValidateNotNull()]
474-
[string] $AgreementNumber
482+
[string] $AgreementNumber,
483+
484+
[Parameter(Mandatory=$false)]
485+
[ValidateNotNull()]
486+
[string] $MsAssetTag
475487
)
476488
#requires -Version 4.0
477489
#requires -RunAsAdministrator
@@ -516,6 +528,7 @@ Function Get-AzsRegistrationToken{
516528
UsageReportingEnabled = $UsageReportingEnabled
517529
AgreementNumber = $AgreementNumber
518530
TokenOutputFilePath = $TokenOutputFilePath
531+
MsAssetTag = $MsAssetTag
519532
}
520533

521534
Log-Output "Registration action params: $(ConvertTo-Json $params)"
@@ -1046,7 +1059,7 @@ Function Get-RegistrationToken{
10461059
[String] $PrivilegedEndpoint,
10471060

10481061
[Parameter(Mandatory = $false)]
1049-
[ValidateSet('Capacity', 'PayAsYouUse', 'Development')]
1062+
[ValidateSet('Capacity', 'PayAsYouUse', 'Development','Custom')]
10501063
[string] $BillingModel = 'Development',
10511064

10521065
[Parameter(Mandatory = $false)]
@@ -1066,7 +1079,11 @@ Function Get-RegistrationToken{
10661079
[PSObject] $StampInfo,
10671080

10681081
[Parameter(Mandatory = $false)]
1069-
[String] $TokenOutputFilePath
1082+
[String] $TokenOutputFilePath,
1083+
1084+
[Parameter(Mandatory=$false)]
1085+
[ValidateNotNull()]
1086+
[string] $MsAssetTag
10701087
)
10711088

10721089
if (-not $StampInfo)
@@ -1082,7 +1099,7 @@ Function Get-RegistrationToken{
10821099
try
10831100
{
10841101
Log-Output "Creating registration token. Attempt $currentAttempt of $maxAttempt"
1085-
$registrationToken = Invoke-Command -Session $session -ScriptBlock { New-RegistrationToken -BillingModel $using:BillingModel -MarketplaceSyndicationEnabled:$using:MarketplaceSyndicationEnabled -UsageReportingEnabled:$using:UsageReportingEnabled -AgreementNumber $using:AgreementNumber }
1102+
$registrationToken = Invoke-Command -Session $session -ScriptBlock { New-RegistrationToken -BillingModel $using:BillingModel -MarketplaceSyndicationEnabled:$using:MarketplaceSyndicationEnabled -UsageReportingEnabled:$using:UsageReportingEnabled -AgreementNumber $using:AgreementNumber -MsAssetTag $using:MsAssetTag }
10861103
if ($TokenOutputFilePath)
10871104
{
10881105
Log-Output "Registration token will be written to: $TokenOutputFilePath"

0 commit comments

Comments
 (0)