Skip to content

Commit 6689580

Browse files
authored
Merge pull request Azure#11323 from dingmeng-xue/fix-resources
Escape single quote
2 parents 75d23cc + 70a784f commit 6689580

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Resources/Resources/ActiveDirectory/Cmdlets/GetAzureADUserCommand.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.WindowsAzure.Commands.Utilities.Common;
16-
using System;
17-
using System.Collections.Generic;
1816
using System.Management.Automation;
1917

2018
namespace Microsoft.Azure.Commands.ActiveDirectory
@@ -64,6 +62,12 @@ public override void ExecuteCmdlet()
6462
Paging = true,
6563
Mail = Mail
6664
};
65+
if(!string.IsNullOrEmpty(options.SearchString))
66+
{
67+
//query string is wrapped with single quote. Escape is needed if it contains additional quote.
68+
options.SearchString = options.SearchString.Replace("'", "''");
69+
}
70+
6771

6872
ulong first = MyInvocation.BoundParameters.ContainsKey("First") ? this.PagingParameters.First : ulong.MaxValue;
6973
ulong skip = MyInvocation.BoundParameters.ContainsKey("Skip") ? this.PagingParameters.Skip : 0;

src/Resources/Resources/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
## Upcoming Release
2121
* Fixed `Get-AzResource -ResourceGroupName -Name -ExpandProperties -ResourceType` to use actual apiVersion of resources instead of default apiVersion [#11267]
2222
* Add correlationId logging for error scenarios
23+
* Escaped single quote in parameter value of `Get-AzADUser` [#11317]
2324

2425
## Version 1.12.0
2526
* Fixed for null reference bug in `Get-AzRoleAssignment`

0 commit comments

Comments
 (0)