Framework/Core/PrivacyNotice.ps1
Set-StrictMode -Version Latest class PrivacyNotice { static [void] ValidatePrivacyAcceptance([string] $acceptNotice) { [bool] $response = $false $appSettings = [ConfigurationManager]::GetLocalAzSdkSettings(); if ([Helpers]::CheckMember($appSettings , "PrivacyNoticeAccepted")) { $response = $appSettings.PrivacyNoticeAccepted; } if (-not $response) { # Prompt to be suppressed in case of automated scenarios such as CA, CICD if ([string]::IsNullOrEmpty($acceptNotice)) { Write-Host " `nAzSDK: EULA and Privacy Disclosure: `nPlease review the following:`n`tEULA (http://aka.ms/azsdkeula)`n`tPrivacy Disclosure (http://aka.ms/azsdkpd)" -ForegroundColor Yellow; $input = "" while ($input -ne "y" -and $input -ne "n") { if (-not [string]::IsNullOrEmpty($input)) { Write-Host "Please select an appropriate option." } $input = Read-Host "Enter 'Y' if you agree and 'N' if you don't (Y/N)" $input = $input.Trim() } if ($input -eq "y") { $result = $true $appSettings.PrivacyNoticeAccepted = $true $appSettings.UsageTelemetryLevel = "Anonymous" [ConfigurationManager]::UpdateAzSdkSettings($appSettings) } if ($input -eq "n") { $result = $false $appSettings.PrivacyNoticeAccepted = $false $appSettings.UsageTelemetryLevel = "None" [ConfigurationManager]::UpdateAzSdkSettings($appSettings) throw ([SuppressedException]::new(("We are sorry to see you go!"), [SuppressedExceptionType]::Generic)) } } else { if ($acceptNotice -eq "yes") { $appSettings.PrivacyNoticeAccepted = $true $appSettings.UsageTelemetryLevel = "Anonymous" [ConfigurationManager]::UpdateAzSdkSettings($appSettings) } if ($acceptNotice -eq "no") { $appSettings.PrivacyNoticeAccepted = $false $appSettings.UsageTelemetryLevel = "None" [ConfigurationManager]::UpdateAzSdkSettings($appSettings) throw ([SuppressedException]::new(("We are sorry to see you go!"), [SuppressedExceptionType]::Generic)) } } } } } |