Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'SkipToken'. Specified method is not supported. #3

Open
chaoscreater opened this issue Aug 12, 2023 · 0 comments

Comments

@chaoscreater
Copy link

chaoscreater commented Aug 12, 2023

Hi, I came across your script "Get-AzureAppGatewayExpiringCertificates" and tried to use it. Keep getting the SkipToken error. If I use just Search-AzGraph @searchParams then it's fine. I haven't looked too much into it yet, but just thought I'd post this here in case you know what's going on.

image

Looks like my $result doesn't have a SkipToken property. I'm guessing when you wrote this, you had a lot of pages in the result. In my case, I have very little data, only 10 elements in the result.

Anyway, I tweaked this a bit and now it works:

$pageSize = 100
$iteration = 0
$searchParams = @{
    Query = 'Resources | where type =~ "Microsoft.Network/applicationGateways" | join kind=leftouter (ResourceContainers | where type=="microsoft.resources/subscriptions" | project subscriptionName=name, subscriptionId) on subscriptionId | project id, subscriptionId, subscriptionName, resourceGroup, name, sslCertificates = properties.sslCertificates | order by id'
    First = $pageSize    
}

$results = @()
do {
    $iteration += 1
    Write-Verbose "Iteration #$iteration"
    $results += Search-AzGraph @searchParams
    if ($results.SkipToken -ne $null) {
    	write-host "More to process!"
        $searchParams.SkipToken = $results.SkipToken
    
    }else{
    
    	write-host "results SkipToken is null"
    }
} while (($results.SkipToken) -ne $null)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant