Skip to content

Commit ebeae79

Browse files
committed
Disable UsageReporting and MarketplaceSyndication for disconnected registration/Capacity billing model
1 parent 75e1d29 commit ebeae79

1 file changed

Lines changed: 13 additions & 25 deletions

File tree

Registration/RegisterWithAzure.psm1

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ function Set-AzsRegistration{
346346
[switch] $MarketplaceSyndicationEnabled = $true,
347347

348348
[Parameter(Mandatory = $false, ParameterSetName = "Register")]
349-
[switch] $UsageReportingEnabled = @{'Capacity'=$true;
349+
[switch] $UsageReportingEnabled = @{'Capacity'=$false;
350350
'PayAsYouUse'=$true;
351351
'Development'=$true;
352352
'Custom'=$false;
@@ -416,11 +416,6 @@ function Set-AzsRegistration{
416416
TokenVersion = Get-RegistrationTokenVersion -AzureContext $AzureContext
417417
}
418418
Log-Output "Get-RegistrationToken parameters: $(ConvertTo-Json $getTokenParams)"
419-
if (($BillingModel -eq 'Capacity') -and ($UsageReportingEnabled))
420-
{
421-
Log-Warning "Billing model is set to Capacity and Usage Reporting is enabled. This data will be used to guide product improvements and will not be used for billing purposes. If this is not desired please halt this operation and rerun with -UsageReportingEnabled:`$false. Execution will continue in 20 seconds."
422-
Start-Sleep -Seconds 20
423-
}
424419
$registrationToken = Get-RegistrationToken @getTokenParams -Session $privilegedEndpointSession -StampInfo $stampInfo
425420

426421
# Register environment with Azure
@@ -645,12 +640,6 @@ Function Get-AzsRegistrationToken{
645640
[ValidateNotNullOrEmpty()]
646641
[String] $TokenOutputFilePath,
647642

648-
[Parameter(Mandatory = $false)]
649-
[Switch] $UsageReportingEnabled = $false,
650-
651-
[Parameter(Mandatory = $false)]
652-
[Switch] $MarketplaceSyndicationEnabled = $false,
653-
654643
[Parameter(Mandatory = $false)]
655644
[ValidateNotNull()]
656645
[string] $AgreementNumber,
@@ -666,16 +655,6 @@ Function Get-AzsRegistrationToken{
666655
New-RegistrationLogFile -RegistrationFunction $PSCmdlet.MyInvocation.MyCommand.Name
667656

668657
Validate-BillingModel -BillingModel $BillingModel -MsAssetTag $MsAssetTag
669-
if(($BillingModel -eq 'Capacity') -and ([String]::IsNullOrEmpty($AgreementNumber)))
670-
{
671-
Log-Throw -Message "Agreement number is null or empty when BillingModel is set to Capacity" -CallingFunction $PSCmdlet.MyInvocation.MyCommand.Name
672-
}
673-
674-
if (($BillingModel -eq 'Capacity') -and ($UsageReportingEnabled))
675-
{
676-
Log-Warning "Billing model is set to Capacity and Usage Reporting is enabled. This data will be used to guide product improvements and will not be used for billing purposes. If this is not desired please halt this operation and rerun with -UsageReportingEnabled:`$false. Execution will continue in 20 seconds."
677-
Start-Sleep -Seconds 20
678-
}
679658

680659
if ($TokenOutputFilePath -and (-not (Test-Path -Path $TokenOutputFilePath -PathType Leaf)))
681660
{
@@ -697,8 +676,8 @@ Function Get-AzsRegistrationToken{
697676
PrivilegedEndpointCredential = $PrivilegedEndpointCredential
698677
PrivilegedEndpoint = $PrivilegedEndpoint
699678
BillingModel = $BillingModel
700-
MarketplaceSyndicationEnabled = $MarketplaceSyndicationEnabled
701-
UsageReportingEnabled = $UsageReportingEnabled
679+
MarketplaceSyndicationEnabled = $false
680+
UsageReportingEnabled = $false
702681
AgreementNumber = $AgreementNumber
703682
TokenOutputFilePath = $TokenOutputFilePath
704683
MsAssetTag = $MsAssetTag
@@ -1261,8 +1240,17 @@ Function Get-RegistrationToken{
12611240
if( ($StampVersion -lt $CustomBillingModelVersion) -and ($BillingModel -eq 'Custom') ){
12621241
Log-Throw -Message "Custom BillingModel is not supported for StampVersion less than $CustomBillingModelVersion" -CallingFunction $PSCmdlet.MyInvocation.MyCommand.Name
12631242
}
1243+
1244+
if (($BillingModel -eq 'Capacity') -and ([String]::IsNullOrEmpty($AgreementNumber))) {
1245+
Log-Throw -Message "Agreement number is null or empty when BillingModel is set to Capacity" -CallingFunction $PSCmdlet.MyInvocation.MyCommand.Name
1246+
}
1247+
1248+
if (($BillingModel -eq 'Capacity') -and ($UsageReportingEnabled)) {
1249+
Log-Warning "Disabling Usage Reporting as it is not supported for Capacity billing model."
1250+
$UsageReportingEnabled = $false
1251+
}
12641252

1265-
$regTokenParams = @{
1253+
$regTokenParams = @{
12661254
BillingModel = $BillingModel
12671255
MarketplaceSyndicationEnabled = $MarketplaceSyndicationEnabled
12681256
UsageReportingEnabled = $UsageReportingEnabled

0 commit comments

Comments
 (0)