Skip to content

Commit

Permalink
Merge pull request #536 from Azure/user/rakku/custombilling-m
Browse files Browse the repository at this point in the history
Custombilling registration
  • Loading branch information
rakku-ms authored Dec 14, 2019
2 parents 8a9106a + 1baf459 commit fef83f7
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions Registration/RegisterWithAzure.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)]
Expand All @@ -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
Expand Down Expand Up @@ -516,6 +528,7 @@ Function Get-AzsRegistrationToken{
UsageReportingEnabled = $UsageReportingEnabled
AgreementNumber = $AgreementNumber
TokenOutputFilePath = $TokenOutputFilePath
MsAssetTag = $MsAssetTag
}

Log-Output "Registration action params: $(ConvertTo-Json $params)"
Expand Down Expand Up @@ -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)]
Expand All @@ -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)
Expand All @@ -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"
Expand Down

0 comments on commit fef83f7

Please sign in to comment.