BrownField/Auto-assessment/scripts/Test-Arc.ps1 (40 lines of code) (raw):

function Test-Arc { param ( [SecureString]$token, [PSCustomObject]$sddc ) try { # Get AVS SDDC details $sddcDetails = Get-AVS-SDDC-Details -sddc $sddc # Define API Endpoint $apiUrl = [string]::Format( "https://management.azure.com/subscriptions/{0}/resourceGroups/{1}/providers/" + "Microsoft.AVS/privateClouds/{2}/addons/arc?api-version=2023-09-01" , $sddcDetails.subscriptionId, $sddcDetails.resourceGroupName, $sddcDetails.sddcName ) # Make the request $response = Invoke-APIRequest ` -method "Get" ` -url $apiUrl ` -token $token # Process the response if ($response) { if ($response.properties.provisioningState -ne "Succeeded") { $recommendationType = "ArcNotProvisioned" } } else { $recommendationType = "ArcNotProvisioned" } # Add the recommendation if (![string]::IsNullOrEmpty($recommendationType)) { $Global:recommendations += Get-Recommendation -type $recommendationType ` -sddcName $sddc.name } } catch { Write-Error "Arc Test failed: $_" } }