Skip to content

Commit eb2b5c5

Browse files
committed
Add support for Configuring External Groups and update documentation
1 parent 2a5d1fc commit eb2b5c5

17 files changed

+634
-271
lines changed

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/ApiManagementClient.cs

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,13 +1059,33 @@ private static QueryParameters CreateQueryUserParameters(string firstName, strin
10591059
#endregion
10601060

10611061
#region Groups
1062-
public PsApiManagementGroup GroupCreate(PsApiManagementContext context, string groupId, string name, string description)
1062+
public PsApiManagementGroup GroupCreate(
1063+
PsApiManagementContext context,
1064+
string groupId,
1065+
string name,
1066+
string description,
1067+
PsApiManagementGroupType? type,
1068+
string externalId)
10631069
{
10641070
var groupCreateParameters = new GroupCreateParameters(name)
10651071
{
10661072
Description = description
10671073
};
10681074

1075+
if (type.HasValue)
1076+
{
1077+
groupCreateParameters.Type = Mapper.Map<GroupTypeContract>(type.Value);
1078+
}
1079+
else
1080+
{
1081+
groupCreateParameters.Type = Mapper.Map<GroupTypeContract>(PsApiManagementGroupType.Custom);
1082+
}
1083+
1084+
if (!string.IsNullOrEmpty(externalId))
1085+
{
1086+
groupCreateParameters.ExternalId = externalId;
1087+
}
1088+
10691089
Client.Groups.Create(context.ResourceGroupName, context.ServiceName, groupId, groupCreateParameters);
10701090

10711091
var response = Client.Groups.Get(context.ResourceGroupName, context.ServiceName, groupId);
@@ -1118,17 +1138,23 @@ public void GroupRemove(PsApiManagementContext context, string groupId)
11181138
Client.Groups.Delete(context.ResourceGroupName, context.ServiceName, groupId, "*");
11191139
}
11201140

1121-
public void GroupSet(PsApiManagementContext context, string groupId, string name, string description)
1141+
public void GroupSet(
1142+
PsApiManagementContext context,
1143+
string groupId,
1144+
string name,
1145+
string description)
11221146
{
1147+
var groupUpdate = new GroupUpdateParameters
1148+
{
1149+
Name = name,
1150+
Description = description
1151+
};
1152+
11231153
Client.Groups.Update(
11241154
context.ResourceGroupName,
11251155
context.ServiceName,
11261156
groupId,
1127-
new GroupUpdateParameters
1128-
{
1129-
Name = name,
1130-
Description = description
1131-
},
1157+
groupUpdate,
11321158
"*");
11331159
}
11341160
#endregion

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/NewAzureApiManagementGroup.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,29 @@ public class NewAzureApiManagementGroup : AzureApiManagementCmdletBase
4848
HelpMessage = "Group description. This parameter is optional.")]
4949
public String Description { get; set; }
5050

51+
[Parameter(
52+
ValueFromPipelineByPropertyName = true,
53+
Mandatory = false,
54+
HelpMessage = "Group Type." +
55+
" Custom Group is User defined Group." +
56+
" System Group includes Administrator, Developers and Guests. You cannot create or update a System Group. " +
57+
" External Group is groups from External Identity Provider like Azure Active Directory." +
58+
" This parameter is optional and by default assumed to be a Custom Group.")]
59+
public PsApiManagementGroupType? Type { get; set; }
60+
61+
[Parameter(
62+
ValueFromPipelineByPropertyName = false,
63+
Mandatory = false,
64+
HelpMessage = "For external groups, this property contains the id of the group from the external identity provider," +
65+
" e.g. Azure Active Directory aad://contoso5api.onmicrosoft.com/groups/12ad42b1-592f-4664-a77b4250-2f2e82579f4c;" +
66+
" otherwise the value is null.")]
67+
public String ExternalId { get; set; }
68+
5169
public override void ExecuteApiManagementCmdlet()
5270
{
5371
string groupId = GroupId ?? Guid.NewGuid().ToString("N");
5472

55-
var group = Client.GroupCreate(Context, groupId, Name, Description);
73+
var group = Client.GroupCreate(Context, groupId, Name, Description, Type, ExternalId);
5674

5775
WriteObject(group);
5876
}

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/SetAzureApiManagementPolicy.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ public class SetAzureApiManagementPolicy : AzureApiManagementCmdletBase
4141
[Parameter(
4242
ValueFromPipelineByPropertyName = true,
4343
Mandatory = false,
44-
HelpMessage = "Format of the policy. This parameter is optional. Default value is 'application/vnd.ms-azure-apim.policy+xml'.")]
44+
HelpMessage = "Format of the policy. This parameter is optional." +
45+
"When using application/vnd.ms-azure-apim.policy+xml, expressions contained within the policy must be XML-escaped." +
46+
"When using application/vnd.ms-azure-apim.policy.raw+xml no escaping is necessary." +
47+
"Default value is 'application/vnd.ms-azure-apim.policy+xml'.")]
4548
public String Format { get; set; }
4649

4750
[Parameter(

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/Get-AzureRmApiManagementBackend.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Get the details of the Backend.
3131

3232

3333

34+
35+
3436
```
3537
Get-AzureRmApiManagementBackend -Context $apimContext
3638
```
@@ -42,6 +44,8 @@ Gets a list of all the Backends configured in the Api Management service.
4244

4345

4446

47+
48+
4549
```
4650
Get-AzureRmApiManagementBackend -Context $apimContext -backendId 123
4751
```
@@ -98,3 +102,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
98102
99103
## RELATED LINKS
100104
105+
[New-AzureRmApiManagementBackend](./New-AzureRmApiManagementBackend.md)
106+
107+
[New-AzureRmApiManagementBackendCredential](./New-AzureRmApiManagementBackendCredential.md)
108+
109+
[New-AzureRmApiManagementBackendProxy](./New-AzureRmApiManagementBackendProxy.md)
110+
111+
[Set-AzureRmApiManagementBackend](./Set-AzureRmApiManagementBackend.md)
112+
113+
[Remove-AzureRmApiManagementBackend](./Remove-AzureRmApiManagementBackend.md)

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/Get-AzureRmApiManagementIdentityProvider.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Get the identity provider configuration details.
3232

3333

3434

35+
36+
3537
```
3638
Get-AzureRmApiManagementIdentityProvider -Context $context
3739
```
@@ -43,6 +45,8 @@ Get all the identity provider Configuration on the service.
4345

4446

4547

48+
49+
4650
```
4751
Get-AzureRmApiManagementIdentityProvider -Context $context -Type Aad
4852
```

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/New-AzureRmApiManagementBackend.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ Creates a new backend entity in Api Management.
2424

2525
## EXAMPLES
2626

27-
### -------------------------- Example 1 --------------------------
28-
@{paragraph=PS C:\\\>}
29-
30-
31-
27+
### Create Backend 123 with a Basic Authorization Scheme
3228
```
3329
$credential = New-AzureRmApiManagementBackendCredential -AuthorizationHeaderScheme basic -AuthorizationHeaderParameter opensesame -Query @{"sv" = @('xx', 'bb'); "sr" = @('cc')} -Header @{"x-my-1" = @('val1', 'val2')}
3430
@@ -262,3 +258,13 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
262258
263259
## RELATED LINKS
264260
261+
[Get-AzureRmApiManagementBackend](./Get-AzureRmApiManagementBackend)
262+
263+
[New-AzureRmApiManagementBackendCredential](./New-AzureRmApiManagementBackendCredential.md)
264+
265+
[New-AzureRmApiManagementBackendProxy](./New-AzureRmApiManagementBackendProxy.md)
266+
267+
[Set-AzureRmApiManagementBackend](./Set-AzureRmApiManagementBackend.md)
268+
269+
[Remove-AzureRmApiManagementBackend](./Remove-AzureRmApiManagementBackend.md)
270+

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/New-AzureRmApiManagementBackendCredential.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ Creates a new Backend Credential contract.
2222

2323
## EXAMPLES
2424

25-
### -------------------------- Example 1 --------------------------
26-
@{paragraph=PS C:\\\>}
27-
28-
29-
25+
### Create a Backend Credentials In-Memory Object
3026
```
3127
$credential = New-AzureRmApiManagementBackendCredential -AuthorizationHeaderScheme basic -AuthorizationHeaderParameter opensesame -Query @{"sv" = @('xx', 'bb'); "sr" = @('cc')} -Header @{"x-my-1" = @('val1', 'val2')}
3228
```
@@ -128,3 +124,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
128124
129125
## RELATED LINKS
130126
127+
[Get-AzureRmApiManagementBackend](./Get-AzureRmApiManagementBackend)
128+
129+
[New-AzureRmApiManagementBackend](./New-AzureRmApiManagementBackend.md)
130+
131+
[New-AzureRmApiManagementBackendProxy](./New-AzureRmApiManagementBackendProxy.md)
132+
133+
[Set-AzureRmApiManagementBackend](./Set-AzureRmApiManagementBackend.md)
134+
135+
[Remove-AzureRmApiManagementBackend](./Remove-AzureRmApiManagementBackend.md)

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/New-AzureRmApiManagementBackendProxy.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ Creates a new Backend Proxy Object which can be piped when creating a new Backen
2121

2222
## EXAMPLES
2323

24-
### -------------------------- Example 1 --------------------------
25-
@{paragraph=PS C:\\\>}
26-
27-
28-
24+
### Create a Backend Proxy In-Memory Object
2925
```
3026
$proxy= New-AzureRmApiManagementBackendProxy -Url "https://abbc.def.g" -UserName "apim" -Password "password"
3127
```
@@ -95,3 +91,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
9591
9692
## RELATED LINKS
9793
94+
[Get-AzureRmApiManagementBackend](./Get-AzureRmApiManagementBackend)
95+
96+
[New-AzureRmApiManagementBackend](./New-AzureRmApiManagementBackend.md)
97+
98+
[New-AzureRmApiManagementBackendCredential](./New-AzureRmApiManagementBackendCredential.md)
99+
100+
[Set-AzureRmApiManagementBackend](./Set-AzureRmApiManagementBackend.md)
101+
102+
[Remove-AzureRmApiManagementBackend](./Remove-AzureRmApiManagementBackend.md)

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/New-AzureRmApiManagementCertificate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# New-AzureRmApiManagementCertificate
99

1010
## SYNOPSIS
11-
Creates an API Management certificate.
11+
Creates an API Management certificate to be used during Authentication with Backend.
1212

1313
## SYNTAX
1414

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/New-AzureRmApiManagementGroup.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Creates an API management group.
1414

1515
```
1616
New-AzureRmApiManagementGroup -Context <PsApiManagementContext> [-GroupId <String>] -Name <String>
17-
[-Description <String>] [<CommonParameters>]
17+
[-Description <String>] [-Type <PsApiManagementGroupType>] [-ExternalId <String>] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -61,6 +61,19 @@ Accept pipeline input: True (ByPropertyName)
6161
Accept wildcard characters: False
6262
```
6363
64+
### -ExternalId
65+
For external groups, this property contains the id of the group from the external identity provider, e.g. Azure Active Directory aad://contoso5api.onmicrosoft.com/groups/12ad42b1-592f-4664-a77b4250-2f2e82579f4c; otherwise the value is null.```yaml
66+
Type: String
67+
Parameter Sets: (All)
68+
Aliases:
69+
70+
Required: False
71+
Position: Named
72+
Default value: None
73+
Accept pipeline input: False
74+
Accept wildcard characters: False
75+
```
76+
6477
### -GroupId
6578
Specifies the identifier of the new management group.
6679
@@ -91,6 +104,19 @@ Accept pipeline input: True (ByPropertyName)
91104
Accept wildcard characters: False
92105
```
93106
107+
### -Type
108+
Group Type. Custom Group is User defined Group. System Group includes Administrator, Developers and Guests. You cannot create or update a System Group. External Group is groups from External Identity Provider like Azure Active Directory. This parameter is optional and by default assumed to be a Custom Group.```yaml
109+
Type: PsApiManagementGroupType
110+
Parameter Sets: (All)
111+
Aliases:
112+
113+
Required: False
114+
Position: Named
115+
Default value: None
116+
Accept pipeline input: True (ByPropertyName)
117+
Accept wildcard characters: False
118+
```
119+
94120
### CommonParameters
95121
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
96122

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/New-AzureRmApiManagementIdentityProvider.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
156156
157157
## RELATED LINKS
158158
159-
[New-AzureRmApiManagementIdentityProvider](./New-AzureRmApiManagementIdentityProvider.md)
160-
161159
[Get-AzureRmApiManagementIdentityProvider](./Get-AzureRmApiManagementIdentityProvider.md)
162160
163161
[Remove-AzureRmApiManagementIdentityProvider](./Remove-AzureRmApiManagementIdentityProvider.md)

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/Remove-AzureRmApiManagementBackend.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ Removes a backend specified by the Identifier from the Api Management.
2121

2222
## EXAMPLES
2323

24-
### -------------------------- Example 1 --------------------------
25-
@{paragraph=PS C:\\\>}
26-
27-
28-
24+
### Example 1: Remove the Backend 123
2925
```
3026
Remove-AzureRmApiManagementBackend -Context $apimContext -BackendId 123 -PassThru
3127
```
@@ -124,3 +120,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
124120
125121
## RELATED LINKS
126122
123+
[Get-AzureRmApiManagementBackend](./Get-AzureRmApiManagementBackend)
124+
125+
[New-AzureRmApiManagementBackend](./New-AzureRmApiManagementBackend.md)
126+
127+
[New-AzureRmApiManagementBackendCredential](./New-AzureRmApiManagementBackendCredential.md)
128+
129+
[New-AzureRmApiManagementBackendProxy](./New-AzureRmApiManagementBackendProxy.md)
130+
131+
[Set-AzureRmApiManagementBackend](./Set-AzureRmApiManagementBackend.md)

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/Remove-AzureRmApiManagementIdentityProvider.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ Removes an existing Identity Provider Configuration.
2121

2222
## EXAMPLES
2323

24-
### -------------------------- Example 1 --------------------------
25-
@{paragraph=PS C:\\\>}
26-
27-
24+
### Removes the Facebook identity provider settings from ApiManagement service
2825

2926
```
3027
Remove-AzureRmApiManagementIdentityProvider -Context $apimContext -Type 'Facebook' -PassThru
@@ -125,4 +122,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
125122
## NOTES
126123
127124
## RELATED LINKS
125+
[New-AzureRmApiManagementIdentityProvider](./New-AzureRmApiManagementIdentityProvider.md)
126+
127+
[Get-AzureRmApiManagementIdentityProvider](./Get-AzureRmApiManagementIdentityProvider.md)
128+
129+
[Set-AzureRmApiManagementIdentityProvider](./Set-AzureRmApiManagementIdentityProvider.md)
128130

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/Set-AzureRmApiManagementBackend.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ Updates an existing backend in the Api Management.
2424

2525
## EXAMPLES
2626

27-
### -------------------------- Example 1 --------------------------
28-
@{paragraph=PS C:\\\>}
29-
30-
27+
### Updates the Description of the Backend 123
3128

3229
```
3330
Set-AzureRmApiManagementBackend -Context $apimContext -BackendId 123 -Description "updated description" -PassThru
@@ -272,3 +269,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
272269
273270
## RELATED LINKS
274271
272+
[Get-AzureRmApiManagementBackend](./Get-AzureRmApiManagementBackend)
273+
274+
[New-AzureRmApiManagementBackend](./New-AzureRmApiManagementBackend.md)
275+
276+
[New-AzureRmApiManagementBackendCredential](./New-AzureRmApiManagementBackendCredential.md)
277+
278+
[New-AzureRmApiManagementBackendProxy](./New-AzureRmApiManagementBackendProxy.md)
279+
280+
[Remove-AzureRmApiManagementBackend](./Remove-AzureRmApiManagementBackend.md)

src/ResourceManager/ApiManagement/Commands.ApiManagement/help/Set-AzureRmApiManagementIdentityProvider.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
170170
171171
## RELATED LINKS
172172
173+
[New-AzureRmApiManagementIdentityProvider](./New-AzureRmApiManagementIdentityProvider.md)
174+
175+
[Get-AzureRmApiManagementIdentityProvider](./Get-AzureRmApiManagementIdentityProvider.md)
176+
177+
[Remove-AzureRmApiManagementIdentityProvider](./Remove-AzureRmApiManagementIdentityProvider.md)

0 commit comments

Comments
 (0)