Framework/Helpers/Helpers.ps1

 using namespace Newtonsoft.Json
using namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
using namespace Microsoft.Azure.Commands.Common.Authentication
using namespace Microsoft.Azure.Management.Storage.Models
Set-StrictMode -Version Latest
class Helpers {
    static [PSObject] $SHA256Alg = [System.Security.Cryptography.HashAlgorithm]::Create('sha256');

    hidden static [PSObject] LoadOfflineConfigFile([string] $fileName, [bool] $parseJson) {
        $rootConfigPath = [Constants]::AzSKAppFolderPath ;
        return [Helpers]::LoadOfflineConfigFile($fileName, $true,$rootConfigPath);
    }
    hidden static [PSObject] LoadOfflineConfigFile([string] $fileName, [bool] $parseJson, $path) {
        #Load file from AzSK App folder
        $rootConfigPath = $path ;

        $extension = [System.IO.Path]::GetExtension($fileName);

        $filePath = $null
        if(Test-Path -Path $rootConfigPath)
        {
            $filePath = (Get-ChildItem $rootConfigPath -Name -Recurse -Include $fileName) | Select-Object -First 1
        }
        #If file not present in App folder load settings from Configurations in Module folder
        if (!$filePath) {
            $rootConfigPath = Join-Path (Get-Item $PSScriptRoot).Parent.FullName "Configurations";
            $filePath = (Get-ChildItem $rootConfigPath -Name -Recurse -Include $fileName) | Select-Object -First 1
        }

        if ($filePath)
        {
            if($parseJson)
            {
                if($extension -eq ".json" -or $extension -eq ".lawsview")
                {
                    $fileContent = (Get-Content -Raw -Path (Join-Path $rootConfigPath $filePath)) | ConvertFrom-Json
                }
                else
                {
                    $fileContent = (Get-Content -Raw -Path (Join-Path $rootConfigPath $filePath))
                }
            }
            else
            {
                $fileContent = (Get-Content -Raw -Path (Join-Path $rootConfigPath $filePath))
            }
        }
        else {
            throw "Unable to find the specified file '$fileName'"
        }
        if (-not $fileContent) {
            throw "The specified file '$fileName' is empty"
        }

        return $fileContent;
    }


    static AbstractClass($obj, $classType) {
        $type = $obj.GetType()
        if ($type -eq $classType) {
            throw("Class '$type' must be inherited")
        }
    }

    static [string] SanitizeFolderName($folderPath) {
        return ($folderPath -replace '[<>:"/\\\[\]|?*]', '');
    }

    static [string] ConvertObjectToString([PSObject] $dataObject, [bool] $defaultPsOutput) {
        [string] $msg = "";
        if ($dataObject) {
            if ($dataObject.GetType().FullName -eq "System.Management.Automation.ErrorRecord") {
                if($dataObject.Exception -is [SuppressedException])
                {
                    $msg = $dataObject.Exception.ConvertToString();
                }
                else
                {
                    if ($defaultPsOutput)
                    {
                        $msg = $dataObject.ToString();
                    }
                    else
                    {
                        $msg = ($dataObject | Out-String) + "`r`nStackTrace: " + $dataObject. ScriptStackTrace
                    }
                }
            }
            else {
                if ($defaultPsOutput -or $dataObject.GetType() -eq [string]) {
                    $msg = $dataObject | Out-String;
                }
                else {
                    try {
                        #$msg = $dataObject | ConvertTo-Json -Depth 5 | Out-String;
                        #$msg = [JsonHelper]::ConvertToJsonCustom($dataObject);
                        $msg = [JsonHelper]::ConvertToPson($dataObject);
                    }
                    catch {
                        $e = $_
                        $msg = $dataObject | Format-List | Out-String;
                    }

                    $msg = $msg.Trim();
                    #$msg = $msg.TrimStart("`r`n");
                }
            }
        }

        return $msg.Trim("`r`n");
    }

    static [bool] CompareObject($referenceObject, $differenceObject) {
        return [Helpers]::CompareObject($referenceObject, $differenceObject, $false)
    }

    static [bool] CompareObject($referenceObject, $differenceObject, [bool] $strictComparison) {
        $result = $true;

        if ($null -ne $referenceObject) {
            if ($null -ne $differenceObject) {
                if ($referenceObject -is "Array") {
                    if ($differenceObject -is "Array") {
                        if ((-not $strictComparison) -or ($referenceObject.Count -eq $differenceObject.Count)) {
                            foreach ($refObject in $referenceObject) {
                                $arrayResult = $false;
                                foreach ($diffObject in $differenceObject) {
                                        $arrayResult = [Helpers]::CompareObject($refObject, $diffObject, $strictComparison);
                                    if ($arrayResult) {
                                        break;
                                    }
                                }

                                $result = $result -and $arrayResult
                                if (-not $arrayResult) {
                                    break;
                                }
                            }
                        }
                        else {
                            $result = $false;
                        }
                    }
                    else {
                        $result = $false;
                    }
                }
                # Condition for all primitive types
                elseif ($referenceObject -is "string" -or $referenceObject -is "ValueType") {
                    # For primitive types, use default comparer
                        $result = $result -and (((Compare-Object $referenceObject $differenceObject) | Where-Object { $_.SideIndicator -eq "<=" } | Measure-Object).Count -eq 0)

                }
                else {
                        $result = $result -and [Helpers]::CompareObjectProperties($referenceObject, $differenceObject, $strictComparison)
                }
            }
            else {
                $result = $false;
            }
        }
        elseif ($null -eq $differenceObject) {
            $result = $true;
        }
        else {
            $result = $false;
        }

        return $result;
    }

    hidden static [bool] CompareObjectProperties($referenceObject, $differenceObject, [bool] $strictComparison) {
        $result = $true;
        $refProps = @();
        $diffProps = @();
        $refProps += [Helpers]::GetProperties($referenceObject);
        $diffProps += [Helpers]::GetProperties($differenceObject);

        if ((-not $strictComparison) -or ($refProps.Count -eq $diffProps.Count)) {
            foreach ($propName in $refProps) {
                $refProp = $referenceObject.$propName;

                if (-not [string]::IsNullOrWhiteSpace(($diffProps | Where-Object { $_ -eq $propName } | Select-Object -First 1))) {
                    $compareProp = $differenceObject.$propName;

                    if ($null -ne $refProp) {
                        if ($null -ne $compareProp) {
                                $result = $result -and [Helpers]::CompareObject($refProp, $compareProp, $strictComparison);
                        }
                        else {
                            $result = $result -and $false;
                        }
                    }
                    elseif ($null -eq $compareProp) {
                        $result = $result -and $true;
                    }
                    else {
                        $result = $result -and $false;
                    }
                }
                else {
                    $result = $false;
                }

                if (-not $result) {
                    break;
                }
            }
        }
        else {
            $result = $false;
        }


        return $result;
    }

    static [bool] CompareObject($referenceObject, $differenceObject, [bool] $strictComparison,$AttestComparisionType) {
        $result = $true;

        if ($null -ne $referenceObject) {
            if ($null -ne $differenceObject) {
                if ($referenceObject -is "Array") {
                    if ($differenceObject -is "Array") {
                        if ((-not $strictComparison) -or ($referenceObject.Count -eq $differenceObject.Count)) {
                            foreach ($refObject in $referenceObject) {
                                $arrayResult = $false;
                                foreach ($diffObject in $differenceObject) {
                                    if($AttestComparisionType -eq [ComparisionType]::NumLesserOrEqual)
                                    {
                                        $arrayResult = [Helpers]::CompareObject($refObject, $diffObject, $strictComparison,$AttestComparisionType);
                                    }
                                    else
                                    {
                                        $arrayResult = [Helpers]::CompareObject($refObject, $diffObject, $strictComparison);
                                    }
                                    if ($arrayResult) {
                                        break;
                                    }
                                }

                                $result = $result -and $arrayResult
                                if (-not $arrayResult) {
                                    break;
                                }
                            }
                        }
                        else {
                            $result = $false;
                        }
                    }
                    else {
                        $result = $false;
                    }
                }
                # Condition for all primitive types
                elseif ($referenceObject -is "string" -or $referenceObject -is "ValueType") {
                    # For primitive types, use default comparer
                    if($AttestComparisionType -eq [ComparisionType]::NumLesserOrEqual)
                    {
                        $result = $result -and  ($referenceObject -ge $differenceObject)
                    }
                    else
                    {
                        $result = $result -and (((Compare-Object $referenceObject $differenceObject) | Where-Object { $_.SideIndicator -eq "<=" } | Measure-Object).Count -eq 0)
                    }

                }
                else {
                    if($AttestComparisionType -eq [ComparisionType]::NumLesserOrEqual)
                    {
                        $result = $result -and [Helpers]::CompareObjectProperties($referenceObject, $differenceObject, $strictComparison,$AttestComparisionType)
                    }
                    else
                    {
                        $result = $result -and [Helpers]::CompareObjectProperties($referenceObject, $differenceObject, $strictComparison)
                    }

                }
            }
            else {
                $result = $false;
            }
        }
        elseif ($null -eq $differenceObject) {
            $result = $true;
        }
        else {
            $result = $false;
        }

        return $result;
    }

    hidden static [bool] CompareObjectProperties($referenceObject, $differenceObject, [bool] $strictComparison,$AttestComparisionType) {
        $result = $true;
        $refProps = @();
        $diffProps = @();
        $refProps += [Helpers]::GetProperties($referenceObject);
        $diffProps += [Helpers]::GetProperties($differenceObject);

        if ((-not $strictComparison) -or ($refProps.Count -eq $diffProps.Count)) {
            foreach ($propName in $refProps) {
                $refProp = $referenceObject.$propName;

                if (-not [string]::IsNullOrWhiteSpace(($diffProps | Where-Object { $_ -eq $propName } | Select-Object -First 1))) {
                    $compareProp = $differenceObject.$propName;

                    if ($null -ne $refProp) {
                        if ($null -ne $compareProp) {
                            if($AttestComparisionType -eq [ComparisionType]::NumLesserOrEqual)
                            {
                                $result = $result -and [Helpers]::CompareObject($refProp, $compareProp, $strictComparison,$AttestComparisionType);
                            }
                            else
                            {
                                $result = $result -and [Helpers]::CompareObject($refProp, $compareProp, $strictComparison);
                            }

                        }
                        else {
                            $result = $result -and $false;
                        }
                    }
                    elseif ($null -eq $compareProp) {
                        $result = $result -and $true;
                    }
                    else {
                        $result = $result -and $false;
                    }
                }
                else {
                    $result = $false;
                }

                if (-not $result) {
                    break;
                }
            }
        }
        else {
            $result = $false;
        }


        return $result;
    }

    static [string[]] GetProperties($object) {
        $props = @();
        if($object)
        {
            if ($object -is "Hashtable") {
                $object.Keys | ForEach-Object {
                    $props += $_;
                };
            }
            else {
                ($object | Get-Member -MemberType Properties) |
                    ForEach-Object {
                    $props += $_.Name;
                };
            }
        }
        return $props;
    }

    static [bool] CompareObjectOld($referenceObject, $differenceObject) {
        $result = $true;

        if ($null -ne $referenceObject) {
            if ($null -ne $differenceObject) {
                ($referenceObject | Get-Member -MemberType Properties) |
                    ForEach-Object {
                    $refProp = $referenceObject."$($_.Name)";

                    if ($differenceObject | Get-Member -Name $_.Name) {
                        $compareProp = $differenceObject."$($_.Name)";

                        if ($null -ne $refProp) {
                            if ($null -ne $compareProp) {
                                if ($refProp.GetType().Name -eq "PSCustomObject") {
                                    $result = $result -and [Helpers]::CompareObjectOld($refProp, $compareProp);
                                }
                                else {
                                    $result = $result -and (((Compare-Object $refProp $compareProp) | Where-Object { $_.SideIndicator -eq "<=" } | Measure-Object).Count -eq 0)
                                }
                            }
                            else {
                                $result = $result -and $false;
                            }
                        }
                        elseif ($null -eq $compareProp) {
                            $result = $result -and $true;
                        }
                        else {
                            $result = $result -and $false;
                        }
                    }
                    else {
                        $result = $false;
                    }
                }
            }
            else {
                $result = $false;
            }
        }
        elseif ($null -eq $differenceObject) {
            $result = $true;
        }
        else {
            $result = $false;
        }

        return $result;
    }

    static [bool] CheckMember([PSObject] $refObject, [string] $memberPath)
    {
        return [Helpers]::CheckMember($refObject, $memberPath, $true);
    }

    static [bool] CheckMember([PSObject] $refObject, [string] $memberPath, [bool] $checkNull)
    {
        [bool]$result = $false;
        if ($refObject) {
            $properties = @();
            $properties += $memberPath.Split(".");

            if ($properties.Count -gt 0) {
                $currentItem = $properties.Get(0);
                if (-not [string]::IsNullOrWhiteSpace($currentItem)) {
                    if ($refObject | Get-Member -Name $currentItem)
                    {
                        if ($properties.Count -gt 1)
                        {
                            if($refObject.$currentItem)
                            {
                                $result = $true;
                                $result = $result -and [Helpers]::CheckMember($refObject.$currentItem, [string]::Join(".", $properties[1..($properties.length - 1)]));
                            }
                        }
                        else
                        {
                            if($checkNull)
                            {
                                if($refObject.$currentItem)
                                {
                                    $result = $true;
                                }
                            }
                            else
                            {
                                $result = $true;
                            }
                        }
                    }
                }
            }
        }
        return $result;
    }

    static [PSObject] SelectMembers([PSObject] $refObject, [string[]] $memberPaths) {
        $result = $null;
        if ($null -ne $refObject) {
            if ($refObject -is "Array") {
                $result = @();
                $refObject | ForEach-Object {
                    $memberValue = [Helpers]::SelectMembers($_, $memberPaths);
                    if ($null -ne $memberValue) {
                        $result += $memberValue;
                    }
                };
            }
            else {
                $processedMemberPaths = @();
                $objectProps = [Helpers]::GetProperties($refObject);
                if ($objectProps.Count -ne 0 -and $null -ne $memberPaths -and $memberPaths.Count -ne 0) {
                    $memberPaths | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } |
                        ForEach-Object {
                        $splitPaths = @();
                        $splitPaths += $_.Split(".");
                        $firstMemberPath = $splitPaths.Get(0);
                        if (-not [string]::IsNullOrWhiteSpace($firstMemberPath) -and $objectProps.Contains($firstMemberPath)) {
                            $pathObject = $processedMemberPaths | Where-Object { $_.MemberPath -eq $firstMemberPath } | Select-Object -First 1;

                            if (-not $pathObject) {
                                $pathObject = @{
                                    MemberPath = $firstMemberPath;
                                    ChildPaths = @();
                                };
                                $processedMemberPaths += $pathObject;
                            }

                            # Count > 1 indicates that it has child path
                            if ($splitPaths.Count -gt 1) {
                                $pathObject.ChildPaths += [string]::Join(".", $splitPaths[1..($splitPaths.length - 1)]);
                            }
                        }
                    };
                }

                if ($processedMemberPaths.Count -ne 0) {
                    $processedMemberPaths | ForEach-Object {
                        $memberValue = $null;

                        if ($_.ChildPaths.Count -eq 0) {
                            $memberValue = $refObject."$($_.MemberPath)";
                        }
                        else {
                            $memberValue = [Helpers]::SelectMembers($refObject."$($_.MemberPath)", $_.ChildPaths);
                        }

                        if ($null -ne $memberValue) {
                            if ($null -eq $result) {
                                $result = New-Object PSObject;
                            }

                            $result | Add-Member -MemberType NoteProperty -Name ($_.MemberPath) -Value $memberValue;
                        }
                    };
                }
                else {
                    $result = $refObject;
                }
            }
        }

        return $result;
    }

    static [string] FetchTagsString([PSObject]$TagsHashTable)
    {
        [string] $tagsString = "";
        try {
            if(($TagsHashTable | Measure-Object).Count -gt 0)
            {
                $TagsHashTable.Keys | ForEach-Object {
                    $key = $_;
                    $value = $TagsHashTable[$key];
                    $tagsString = $tagsString + "$($key):$($value);";
                }
            }
        }
        catch {
            #eat exception as if not able to fetch tags, it would return empty instead of breaking the flow
        }
        return $tagsString;
    }

    static [string] ComputeHash([String] $data)
    {
        #Call the other function but request the full 32-byte == 64 hex chars (SHA56 hash) as string
        return [Helpers]::ComputeHashShort($data, 64)
    }

    static [string] ComputeHashShort([String] $data, [int] $len)
    {
        $retHashSB = [System.Text.StringBuilder]::new();
        $hashBytes = [Helpers]::SHA256Alg.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($data));

        $usedBytes = $len/2 #If N hex chars are needed, first N/2 bytes of the hash are used.
        #Grab only as many bytes from hash to use for returned hashString.
        #We use "x2" instead of just "x" to ensure that '4' becomes '04' in the returned string (applicable to anything <16)
        #Overall, this ensures that the string conversion of a full SHA256 hash is *always* 64 chars long.
        for ($i=0;$i -lt $usedBytes; $i++)
        {
            [void]$retHashSB.Append($hashBytes[$i].ToString("x2"))
        }
        return $retHashSB.ToString()
    }

    static [VerificationResult] EvaluateVerificationResult([VerificationResult] $verificationResult, [AttestationStatus] $attestationStatus) {
        [VerificationResult] $result = $verificationResult;
        # No action required if Attestation status is None OR verification result is Passed
        if ($attestationStatus -ne [AttestationStatus]::None -or $verificationResult -ne [VerificationResult]::Passed) {
            # Changing State Machine logic
            #if($verificationResult -eq [VerificationResult]::Verify -or $verificationResult -eq [VerificationResult]::Manual)
            #{
            switch ($attestationStatus) {
                ([AttestationStatus]::NotAnIssue) {
                    $result = [VerificationResult]::Passed;
                    break;
                }
                ([AttestationStatus]::WillNotFix) {
                    $result = [VerificationResult]::Exception;
                    break;
                }
                ([AttestationStatus]::WillFixLater) {
                    $result = [VerificationResult]::Remediate;
                    break;
                }
                ([AttestationStatus]::NotApplicable) {
                    $result = [VerificationResult]::Passed;
                    break;
                }
                ([AttestationStatus]::StateConfirmed) {
                    $result = [VerificationResult]::Passed;
                    break;
                }
                ([AttestationStatus]::ApprovedException) {
                    $result = [VerificationResult]::Passed;
                    break;
                }
            }
            #}
            #elseif($verificationResult -eq [VerificationResult]::Failed -or $verificationResult -eq [VerificationResult]::Error)
            #{
            # $result = [VerificationResult]::RiskAck;
            #}
        }
        return $result;
    }

    static [PSObject] NewSecurePassword() {
        #create password
        $randomBytes = New-Object Byte[] 32
        $provider = [System.Security.Cryptography.RNGCryptoServiceProvider]::Create()
        $provider.GetBytes($randomBytes)
        $provider.Dispose()
        $pwstring = [System.Convert]::ToBase64String($randomBytes)
        $newPassword = new-object securestring
        $pwstring.ToCharArray() | ForEach-Object {
            $newPassword.AppendChar($_)
        }
        $encryptedPassword = ConvertFrom-SecureString -SecureString $newPassword -Key (1..16)
        $securePassword = ConvertTo-SecureString -String $encryptedPassword -Key (1..16)
        return $securePassword
    }

    static [PSObject] DeepCopy([PSObject] $inputObject)
    {
        $memoryStream = New-Object System.IO.MemoryStream
        $binaryFormatter = New-Object System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
        $binaryFormatter.Serialize($memoryStream, $inputObject)
        $memoryStream.Position = 0
        $dataDeep = $binaryFormatter.Deserialize($memoryStream)
        $memoryStream.Close()
        return $dataDeep
    }



    static [bool] ValidateEmail([string]$address){
        $validAddress = ($address -as [System.Net.Mail.MailAddress])
        return ($null -ne $validAddress -and  $validAddress.Address -eq $address )
    }

    #Returns invalid email list
    static [string[]] ValidateEmailList([string[]]$emailList )
    {
        $invalidEmails = @();
           $emailList | ForEach-Object {
            if(-not [Helpers]::ValidateEmail($_))
            {
                $invalidEmails += $_
            }
        }
        return $invalidEmails
    }

    static [Object] MergeObjects([Object] $source,[Object] $extend, [string] $idName)
    {
        $idPropName = "Id";
        if(-not [string]::IsNullOrWhiteSpace($idName))
        {
            $idPropName = $idName;
        }
        if($source.GetType().Name -eq "PSCustomObject" -and $extend.GetType().Name -eq "PSCustomObject"){
            foreach($Property in $extend | Get-Member -type NoteProperty, Property){
                if(-not [Helpers]::CheckMember($source,$Property.Name,$false)){
                  $source | Add-Member -MemberType NoteProperty -Value $extend.$($Property.Name) -Name $Property.Name `
                }
                $source.$($Property.Name) = [Helpers]::MergeObjects($source.$($Property.Name), $extend.$($Property.Name), $idName)
            }
        }
        elseif($source.GetType().Name -eq "Object[]" -and $extend.GetType().Name -eq "Object[]"){
            if([Helpers]::IsPSObjectArray($source) -or [Helpers]::IsPSObjectArray($extend))
            {
               foreach($extendArrElement in $extend)  {
                     $PropertyId = $extendArrElement | Get-Member -type NoteProperty, Property | Where-Object { $_.Name -eq $idPropName}  | Select-Object -First 1
                     if(($PropertyId | Measure-Object).Count -gt 0)
                     {
                         $PropertyId = $PropertyId | Select-Object -First 1
                     }
                     else {
                        $PropertyId = $extendArrElement | Get-Member -type NoteProperty, Property | Select-Object -First 1
                     }
                     $sourceElement = $source | Where-Object { $_.$($PropertyId.Name) -eq $extendArrElement.$($PropertyId.Name) }
                     if($sourceElement)
                     {
                        $sourceElement =  [Helpers]::MergeObjects($sourceElement, $extendArrElement, $idName)
                     }
                     else
                     {
                        $source +=$extendArrElement
                     }
                }
            }
            else
            {
                $source = ($source + $extend)
                if ($source.Count -gt 0)
                {
                    $source = @($source | Select-Object -Unique)
                }
            }
        }
        else{
           $source = $extend;
        }
        return $source
    }


    static [Object] MergeObjects([Object] $source,[Object] $extend)
    {
        return [Helpers]::MergeObjects($source,$extend,"");
    }

    static [Bool] IsPSObjectArray($arrayObj)
    {
        if(($arrayObj | Measure-Object).Count -gt 0)
        {
            $firstElement = $arrayObj | Select-Object -First 1
            if($firstElement.GetType().Name -eq "PSCustomObject")
            {
                return $true
            }
            else
            {
                return $false
            }
        }
        else
        {
            return $false
        }
    }

    #BOM replace function
    static [void] RemoveUtf8BOM([System.IO.FileInfo] $file)
    {
        [Helpers]::SetUtf8Encoding($file);
        if($file)
        {
            $byteBuffer = New-Object System.Byte[] 3
            $reader = $file.OpenRead()
            $bytesRead = $reader.Read($byteBuffer, 0, 3);
            if ($bytesRead -eq 3 -and
                $byteBuffer[0] -eq 239 -and
                $byteBuffer[1] -eq 187 -and
                $byteBuffer[2] -eq 191)
            {
                $tempFile = [System.IO.Path]::GetTempFileName()
                $writer = [System.IO.File]::OpenWrite($tempFile)
                $reader.CopyTo($writer)
                $writer.Dispose()
                $reader.Dispose()
                Move-Item -Path $tempFile -Destination $file.FullName -Force
            }
            else
            {
                $reader.Dispose()
            }
        }
    }

    static [void] SetUtf8Encoding([System.IO.FileInfo] $file)
    {
        if($file)
        {
            $fileContent = Get-Content -Path $file.FullName;
            if($fileContent)
            {
                Out-File -InputObject $fileContent -Force -FilePath $file.FullName -Encoding utf8
            }
        }
    }

    static [void] CleanupLocalFolder($folderPath)
    {
        try
        {
            if(Test-Path $folderPath)
            {
                Remove-Item -Path $folderPath -Recurse -Force -ErrorAction Stop | Out-Null
            }
        }
        catch{
            #this call happens from finally block. Try to clean the files, if it don't happen it would get cleaned in the next attempt
        }
    }

    static [void] CreateFolderIfNotExist($FolderPath,$MakeFolderEmpty)
    {
        if(-not (Test-Path $FolderPath))
        {
            New-Item -ItemType Directory -Path $FolderPath -ErrorAction Stop | Out-Null
        }
        elseif($MakeFolderEmpty)
        {
            Remove-Item -Path (Join-Path $FolderPath "*") -Force -Recurse
        }
    }

    Static [string] GetSubString($CotentString, $Pattern)
    {
        return  [regex]::match($CotentString, $pattern).Groups[1].Value
    }

    #TODO: Currently this function is specific to Org PolicyHealth Check. Need to make generic
    Static [string] IsStringEmpty($String)
    {
        if([string]::IsNullOrEmpty($String))
        {
            return "Not Available"
        }
        else
        {
            $String= $String.Split("?")[0]
            return $String
        }
    }

    Static [bool] IsSASTokenUpdateRequired($policyUrl)
    {
        [System.Uri] $validatedUri = $null;
        $IsSASTokenUpdateRequired = $false

        if([System.Uri]::TryCreate($policyUrl, [System.UriKind]::Absolute, [ref] $validatedUri) -and $validatedUri.Query.Contains("&se="))
        {
            $pattern = '&se=(.*?)T'
            [DateTime] $expiryDate = Get-Date
            if([DateTime]::TryParse([Helpers]::GetSubString($($validatedUri.Query),$pattern),[ref] $expiryDate))
            {
               if($expiryDate.AddDays(-[Constants]::SASTokenExpiryReminderInDays) -lt [DateTime]::UtcNow)
               {
                   $IsSASTokenUpdateRequired = $true
               }
            }
        }
        return $IsSASTokenUpdateRequired
    }

    Static [string] GetUriWithUpdatedSASToken($policyUrl, $updateUrl)
    {
        [System.Uri] $validatedUri = $null;
        $UpdatedUrl = $policyUrl

        if([System.Uri]::TryCreate($policyUrl, [System.UriKind]::Absolute, [ref] $validatedUri) -and $validatedUri.Query.Contains("&se=") -and [System.Uri]::TryCreate($policyUrl, [System.UriKind]::Absolute, [ref] $validatedUri))
        {

            $UpdatedUrl = $policyUrl.Split("?")[0] + "?" + $updateUrl.Split("?")[1]

        }
        return $UpdatedUrl
    }

    static [string] ReadInput($Prompt) {
        return (Read-Host -Prompt $Prompt).Trim()
    }

    static [string] CreateSharedKey([string] $StringToSign,[string] $ResourceName,[string] $AccessKey)
    {
        $KeyBytes = [System.Convert]::FromBase64String($AccessKey)
        $HMAC = New-Object System.Security.Cryptography.HMACSHA256
        $HMAC.Key = $KeyBytes
        $UnsignedBytes = [System.Text.Encoding]::UTF8.GetBytes($StringToSign)
        $KeyHash = $HMAC.ComputeHash($UnsignedBytes)
        $SignedString = [System.Convert]::ToBase64String($KeyHash)
        $sharedKey = $ResourceName+":"+$SignedString
        return $sharedKey
    }

    # Convert secure string to plain text
    static [string] ConvertToPlainText([System.Security.SecureString] $secureString)
    {
        $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureString)
        $plainText = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
        return $plainText
    }

    # Get object of a particular permission (which are allowed) for a group.
    static [object] ResolvePermissions($permissionsInBit, $actions, $permissionName)
    {
        $obj = @();
        #$editPerms = @();
        #check allowed permissions
        if($permissionsInBit -gt 0 )
        {
            $permissionsInBinary = [convert]::ToString($permissionsInBit,2) # to binary
            # loop thru the decoded base 2 number and check the bit. if 1(on) then that permission is set

            for ($a = 0 ; $a -lt $permissionsInBinary.Length; $a++)
            {
                if( $permissionsInBinary.Substring($permissionsInBinary.Length-$a-1,1) -ge 1) # each binary digit
                {
                    # find bit in action list
                    $raise = [Math]::Pow(2, $a)
                    $bit = $actions | Where-Object {$_.bit -eq $raise }
                    $obj += $bit | Where-Object {$_.displayName -eq $permissionName}
                }
            }
        }
        return $obj
    }

    # Resolve allowed permissions of a particular group.
    static [object] ResolveAllPermissions($AllowedPermissionsInBit, $InheritedAllowedPermissionsInBit, $actions)
    {
        $obj = @();
        #$editPerms = @();
        #check allowed permissions
        if($AllowedPermissionsInBit -gt 0 )
        {
            $permissionsInBinary = [convert]::ToString($AllowedPermissionsInBit,2) # to binary
            # loop thru the decoded base 2 number and check the bit. if 1(on) then that permission is set

            for ($a = 0 ; $a -lt $permissionsInBinary.Length; $a++)
            {
                if( $permissionsInBinary.Substring($permissionsInBinary.Length-$a-1,1) -ge 1) # each binary digit
                {
                    # find bit in action list
                    $raise = [Math]::Pow(2, $a)
                    $bit = $actions | Where-Object {$_.bit -eq $raise }
                    $obj += New-Object -TypeName psobject -Property @{Name= $bit.displayName ; Permission="Allow"}
                }
            }
        }

        if($InheritedAllowedPermissionsInBit -gt 0 )
        {
            $permissionsInBinary = [convert]::ToString($InheritedAllowedPermissionsInBit,2) # to binary
            # loop thru the decoded base 2 number and check the bit. if 1(on) then that permission is set

            for ($a = 0 ; $a -lt $permissionsInBinary.Length; $a++)
            {
                if( $permissionsInBinary.Substring($permissionsInBinary.Length-$a-1,1) -ge 1) # each binary digit
                {
                    # find bit in action list
                    $raise = [Math]::Pow(2, $a)
                    $bit = $actions | Where-Object {$_.bit -eq $raise }
                    $obj += New-Object -TypeName psobject -Property @{Name= $bit.displayName ; Permission="Allow (inherited)"}
                }
            }
        }

        $obj = $obj | Sort-Object -Property Name

        return $obj
    }

    static [System.Security.SecureString] GetVariableFromKVUrl($url){
        $variable = $null;
        $context = @(Get-AzContext -ErrorAction SilentlyContinue )
        if ($context.count -eq 0)  {
            Write-Host "No active Azure login session found.`r`nPlease login to Azure tenant hosting the key vault..." -ForegroundColor Yellow
            Connect-AzAccount -ErrorAction Stop
            $context = @(Get-AzContext -ErrorAction SilentlyContinue)
        }

        if ($null -eq $context)  {
            Write-Host "Login failed. Azure login context is required to use a key vault-based PAT token.`r`nStopping scan command." -ForegroundColor Red            
        }
        #Parse the key-vault-URL to determine vaultname, secretname, version
        if ($url -match "^https://(?<kv>[\w]+)(?:[\.\w+]*)/secrets/(?<sn>[\w]+)/?(?<sv>[\w]*)")
        {
            $kvName = $Matches["kv"]
            $secretName = $Matches["sn"]
            $secretVersion = $Matches["sv"]

            if (-not [String]::IsNullOrEmpty($secretVersion))
            {
                $kvSecret = Get-AzKeyVaultSecret -VaultName $kvName -SecretName $secretName -Version $secretVersion
            }
            else
            {
                $kvSecret = Get-AzKeyVaultSecret -VaultName $kvName -SecretName $secretName
            }

            if ($null -ne $kvSecret)
            {
                $variable = $kvSecret.SecretValue;
            }
            
        }
        return $variable        
    }
}


# SIG # Begin signature block
# MIIoPAYJKoZIhvcNAQcCoIIoLTCCKCkCAQExDz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