Skip to content

Commit 70a784f

Browse files
committed
Escape single quote
1 parent 145bf0c commit 70a784f

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
@@ -19,6 +19,7 @@
1919
-->
2020
## Upcoming Release
2121
* Add correlationId logging for error scenarios
22+
* Escaped single quote in parameter value of `Get-AzADUser` [#11317]
2223

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

0 commit comments

Comments
 (0)