Azure / Azure/azure-powershell

Get-AzDataProtectionBackupInstance only returns up to 200 backup instances

Open
#18,904 9 comments 0 reactions 1 assignee Claimed by @hiaga View on GitHub
bug customer-reported DataProtection Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### 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

```PowerShell
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions//backupInstances?api-version=2022-04-01

Headers:
x-ms-unique-id : 15
x-ms-client-request-id :
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": [],
"nextLink": "https://management.azure.com/subscriptions/.../resourceGroups/.../providers/Microsoft.DataProtection/backupVaults/.../backupInstances?api-version=2022-04-01&$skiptoken=2.0Table......Primary"
}

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

```PowerShell
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

```PowerShell
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

```PowerShell
The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.