Hi,
The correct way to get all records via Search-AzGraph cmdlet is to get this in batches. Meaning executing the command multiple times until you get all the results. What is important is to add sorting to your query like:
$totalquery="resourcechanges
|extend changeType = tostring(properties.changeType), targetResourceType = tostring(properties.targetResourceType), changeTime = todatetime(properties.changeAttributes.timestamp)
| where targetResourceType !~ 'microsoft.web/connections
| sort by changeTime asc '"
After that the first command will be like
$totalChanges = Search-AzGraph "$($totalquery)" -First 1000
After that you will need to check the count of $totalChanges.Count(). If the count is 1000 or higher you do another command:
$totalChanges = Search-AzGraph "$($totalquery)" -First 1000 -Skip 1000
And you do the same until the count is not 1000 or higher. It is important that you add the results into one variable and to increase the skip number by 1000 every time you execute the query.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.