Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add-AzApiManagementUserToGroup does not accept GroupdID with whitespace #9351

Closed
majofoal opened this issue Jun 3, 2019 · 5 comments
Closed
Assignees
Labels
API Management feature-request This issue requires a new behavior in the product in order be resolved. Service Attention This issue is responsible by Azure service team.

Comments

@majofoal
Copy link

majofoal commented Jun 3, 2019

Description

I have a GroupID with a whitespace on the name. I have been using this same GroupID but this cmdlet does not allow GroupID with whitespace. On my API Management instance I am not able to change the GroupID, as this is not modifiable.

GroupID name: API Providers

Steps to reproduce

Add-AzApiManagementUserToGroup -Context $apimContext -GroupId $group.GroupId -UserId $user.UserId 

Environment data

Name                           Value

----                           -----

PSVersion                      5.1.17763.503

PSEdition                      Desktop

PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}

BuildVersion                   10.0.17763.503

CLRVersion                     4.0.30319.42000

WSManStackVersion              3.0

PSRemotingProtocolVersion      2.3

SerializationVersion           1.1.0.1

Module versions

Get-Module.txt

Debug output


Error output

Add-AzApiManagementUserToGroup : 'groupId' does not match expected pattern '(^[\\w]+$)|(^[\\w][\\w\\-]+[\\w]$)'.
@markcowl markcowl added API Management Service Attention This issue is responsible by Azure service team. labels Jun 5, 2019
@markcowl
Copy link
Member

markcowl commented Jun 5, 2019

@solankisamir Looks like the validation pattern should be less restrictive, and the cmdlet should be able to url encode legal vales before sending the request (the .Net SDK generally does this automatically for path parameters).

@solankisamir
Copy link
Member

@markcowl I will discuss with the team and see if we should lift the limitation. The validation for not having spaces in GroupId was put in 06/2015.

@solankisamir
Copy link
Member

Workaround for the customer

PS c:> Connect-AzAccount
PS c:> Select-AzSubscription -SubscriptionName api_Developer
PS c:> $gid = "templateGroup"
PS c:> $subscriptionId = "axxxx-6xxx-494d-9dbf-687baxxxxx"
PS c:> $uId = "kjoshiarmTemplateUser3"
PS c:> $resourceId = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $context.ResourceGroupName + "/providers/Microsoft.ApiManagement/service/" + $context.ServiceName + "/groups/" + $gid + "/users/" + $uId
PS c:> New-AzResource -ResourceId $resourceId -ApiVersion "2018-01-01"

Name : kjoshiarmTemplateUser3
ResourceId : /subscriptions/axxxxx-6b82-494d-9dbf-6xxxxxx/resourceGroups/template-test-smapi-WestUS/providers/Microsoft.ApiManagement/service/templatetestsmapientities/groups/templateGroup/users/kjoshiarmTemplateUser3
ResourceName : templatetestsmapientities/templateGroup/kjoshiarmTemplateUser3
ResourceType : Microsoft.ApiManagement/service/groups/users
ResourceGroupName : template-test-smapi-WestUS
SubscriptionId : axxxxx-6b82-4xx-9dbf-687bxxxx
Properties : @{firstName=Kedar3; lastName=Joshi3; email=[email protected]; state=active; registrationDate=2017-06-05T23:31:01.79Z; note=note for user 3; groups=System.Object[]; identities=System.Object[]}

@mjconnection mjconnection added the feature-request This issue requires a new behavior in the product in order be resolved. label Jun 19, 2019
@majofoal
Copy link
Author

majofoal commented Jul 4, 2019

Hello, @solankisamir is there an ETA for this item?

@solankisamir
Copy link
Member

Resolved with the release of a new cmdlet version
https://github.com/Azure/azure-powershell/releases/tag/v2.6.0-August2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Management feature-request This issue requires a new behavior in the product in order be resolved. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants