Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/AppConfiguration/AppConfiguration/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed GitHub issue #23731 'Problem with Get-AzAppConfigurationKeyValue when more that 100 records are present'
- Fixed `NextLink` property to give absolute URI, allowing subsequent pages of results to be retrieved.

## Version 2.0.0
* Introduced various new features by upgrading code generator. Please see detail [here](https://github.com/Azure/azure-powershell/blob/main/documentation/Autorest-powershell-v4-new-features.md).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace Microsoft.Azure.PowerShell.Cmdlets.AppConfigurationdata.Cmdlets
{
using static Microsoft.Azure.PowerShell.Cmdlets.AppConfigurationdata.Runtime.Extensions;
using Microsoft.Azure.PowerShell.Cmdlets.AppConfigurationdata.Runtime.PowerShell;
using System;
using System.Net.Http;
using System.Threading.Tasks;

/// <summary>Custom partial implementation to fix pagination with relative @nextLink URLs</summary>
public partial class GetAzAppConfigurationKeyValue_Get
{
/// <summary>
/// Override the onOk hook to implement custom pagination logic that handles relative @nextLink URLs
/// </summary>
/// <param name="responseMessage">the raw response message as an global::System.Net.Http.HttpResponseMessage.</param>
/// <param name="response">the body result as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.AppConfigurationdata.Models.IKeyValueListResult">Microsoft.Azure.PowerShell.Cmdlets.AppConfigurationdata.Models.IKeyValueListResult</see> from the remote call</param>
/// <param name="returnNow">Determines if the rest of the onOk processing should be processed, or if the method should return instantly.</param>
partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.AppConfigurationdata.Models.IKeyValueListResult> response, ref global::System.Threading.Tasks.Task<bool> returnNow)
{
var result = response.GetAwaiter().GetResult();
if (!string.IsNullOrEmpty(result.NextLink) && responseMessage?.RequestMessage != null)
{
// Check if nextLink is relative and convert to absolute
if (!Uri.IsWellFormedUriString(result.NextLink, UriKind.Absolute))
{
var baseUri = new Uri(responseMessage.RequestMessage.RequestUri.GetLeftPart(UriPartial.Authority));
var absoluteUri = new Uri(baseUri, result.NextLink);

// Modify the result's NextLink
if (result is Microsoft.Azure.PowerShell.Cmdlets.AppConfigurationdata.Models.KeyValueListResult mutableResult)
{
mutableResult.NextLink = absoluteUri.ToString();
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ Describe 'Get-AzAppConfigurationKeyValue' -Tag 'LiveOnly' {
Get-AzAppConfigurationKeyValue -Endpoint $env.endpoint
} | Should -Not -Throw
}
}

It 'List returns all paged results' {
$allResults = Get-AzAppConfigurationKeyValue -Endpoint $env:endpoint -Key '*'
$allResults.Count | Should -BeGreaterThan 100
}
}