Skip to content

Commit

Permalink
Fixed Set-AzPolicySetDefinition InternalServerError when the initia…
Browse files Browse the repository at this point in the history
…tive is too large [#20238] (#20252)

Co-authored-by: Xuejun Li <[email protected]>
  • Loading branch information
rachelxj-ms and Xuejun Li authored Nov 28, 2022
1 parent e6b15b4 commit 8bf099e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.RestClients
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
Expand Down Expand Up @@ -163,6 +164,8 @@ protected async Task<HttpResponseMessage> SendRequestAsync(
CancellationToken cancellationToken)
{
var contentString = content == null ? string.Empty : content.ToString();
// minify JOSN payload to avoid payload too large error
contentString = Regex.Replace(contentString, @"\r\n?|\n|\t| ", String.Empty);
using (var httpContent = new StringContent(content: contentString, encoding: Encoding.UTF8, mediaType: "application/json"))
using (var request = new HttpRequestMessage(method: httpMethod, requestUri: requestUri) { Content = httpContent })
{
Expand Down
1 change: 1 addition & 0 deletions src/Resources/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

## Upcoming Release
* Added cmdlet `Get-AzADOrganization`
* Fixed `Set-AzPolicySetDefinition` InternalServerError when the initiative is too large [#20238]

## Version 6.4.1
* Upgraded AutoMapper to Microsoft.Azure.PowerShell.AutoMapper 6.2.2 with fix [#18721]
Expand Down

0 comments on commit 8bf099e

Please sign in to comment.