Test-CosmosDBVariable.ps1
function Test-CosmosDBVariable { <# .SYNOPSIS Tests the variables needed for the AxCosmosDB cmdlets to run .DESCRIPTION Tests the variables needed for the AxCosmosDB cmdlets to run .PARAMETER CosmosDBVariables This is the Script variable generated by Connect-CosmosDB that are to be testet .EXAMPLE Test-CosmosDBVariable $CosmosDBVariables .NOTES Just to be sure ... #> [CmdletBinding()] param ( [Parameter(Mandatory = $True)] [hashtable] $CosmosDBVariables ) begin { } process { 'URI','Key','KeyType','tokenVersion' | ForEach-Object { $Value = $CosmosDBVariables[$_] If (!$Value){ Write-Warning "$_ not found in CosmosDBVariables. Run Connect-CosmosDB to update" continue } } } end { } } |