azure-powershell
azure-powershell copied to clipboard
Get-AzDataProtectionBackupInstance only returns up to 200 backup instances
Description
Hello, in the Azure Portal we have > 200 backup instances in a backup vault.
We are using Get-AzDataProtectionBackupInstance to read the backup vault and check that our VM disks are protected, however it fails because the command does not return all the protected disks.
Get-AzDataProtectionBackupInstance -ResourceGroupName '<>' -VaultName '<>' -SubscriptionId '<>' | Measure-Object
Returns a count of 200.
This makes the command unreliable past 200 instances.
Tested using Az.DataProtection v0.3.1 and v0.4.0
In the debug I can see the nextLink property however it seems that the cmdlet is not using it.
Issue script & Debug output
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/<redacted>/backupInstances?api-version=2022-04-01
Headers:
x-ms-unique-id : 15
x-ms-client-request-id : <redacted>
CommandName : Get-AzDataProtectionBackupInstance
FullCommandName : Get-AzDataProtectionBackupInstance_List
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v5.1.19041.1682,Az.DataProtection/0.4.0
Body:
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Pragma : no-cache
X-Content-Type-Options : nosniff
x-ms-request-id :
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-resource-requests: 1988
x-ms-correlation-request-id : 0b9116a3-d6cd-4790-9bfb-4e4c2c550325
x-ms-routing-request-id : CANADACENTRAL:20220708T202355Z:0b9116a3-d6cd-4790-9bfb-4e4c2c550325
Cache-Control : no-cache
Date : Fri, 08 Jul 2022 20:23:54 GMT
Server : Microsoft-IIS/10.0
X-Powered-By : ASP.NET
Body:
{
"value": [<redacted>],
"nextLink": "https://management.azure.com/subscriptions/.../resourceGroups/.../providers/Microsoft.DataProtection/backupVaults/.../backupInstances?api-version=2022-04-01&$skiptoken=<?xml version="1.0" encoding="utf-16"?><ContinuationToken><Version>2.0</Version><Type>Table</Type><NextPartitionKey>...</NextPartitionKey><NextRowKey>...</NextRowKey><TargetLocation>Primary</TargetLocation></ContinuationToken>"
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.DataProtection:0.4.0; CommandName: Get-AzDataProtectionBackupInstance; PSVersion: 5.1.19041.1682; IsSuccess: True; Duration: 00:00:02.7890106
Count : 200
Average :
Sum :
Maximum :
Minimum :
Property :
Environment data
Name Value
---- -----
PSVersion 5.1.19041.1682
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1682
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Module versions
ModuleType Version Name
---------- ------- ----
Script 2.9.0 Az.Accounts
Script 4.29.0 Az.Compute
Script 0.4.0 Az.DataProtection
Script 4.6.0 Az.KeyVault
Script 5.4.1 Az.RecoveryServices
Script 0.12.0 Az.ResourceGraph
Script 6.0.1 Az.Resources
Error output
The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.
Thank you for your feedback. This has been routed to the support team for assistance.
@bwarren18 We are looking into it and get back to you for any additional information.
Thank you for your feedback. This has been routed to the support team for assistance.
FYI the issue is still present using Az.DataProtection v0.5.0 .
FYI we we're able to work around this issue using Search-AzDataProtectionBackupInstanceInAzGraph instead.
@bwarren18 : It's great to know that you're unblocked on this with Search-AzDataProtectionBackupInstanceInAzGraph. Please let me know if you still need us to investigate on Get-AzDataProtectionBackupInstance command for more than 200 items.
@adityabalaji-msft FYI.
@hiaga, the issue with 'Get-AzDataProtectionBackupInstance' only returning up to 200 objects persists with Az.DataProtection v1.2.0 and the new v2.0.0 module.
@hiaga could you please check