Skip to content

Commit 94a3892

Browse files
[Resources] Move Resources to release 2022-03-01 (#17252)
* Move Resources to release-2022-03-01 * update changelog, suppress breaking change issues Co-authored-by: azure-powershell-bot <[email protected]>
1 parent 265dd93 commit 94a3892

18 files changed

+181
-483
lines changed

src/Resources/MSGraph.Autorest/custom/New-AzADAppCredential.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ function New-AzADAppCredential {
224224
switch ($PSCmdlet.ParameterSetName) {
225225
{ $_ -in 'ApplicationObjectIdWithPasswordParameterSet', 'ApplicationObjectIdWithKeyCredentialParameterSet', 'ApplicationObjectIdWithPasswordCredentialParameterSet', 'ApplicationObjectIdWithCertValueParameterSet'} {
226226
$id = $PSBoundParameters['ObjectId']
227+
if ($kc) {
228+
$app = Get-AzADApplication -ObjectId $id
229+
}
227230
$null = $PSBoundParameters.Remove('ObjectId')
228231
break
229232
}
@@ -259,6 +262,9 @@ function New-AzADAppCredential {
259262
}
260263
{ $_ -in 'ApplicationObjectWithPasswordParameterSet', 'ApplicationObjectWithKeyCredentialParameterSet', 'ApplicationObjectWithPasswordCredentialParameterSet', 'ApplicationObjectWithCertValueParameterSet'} {
261264
$id = $PSBoundParameters['ApplicationObject'].Id
265+
if ($kc) {
266+
$app = Get-AzADApplication -ObjectId $id
267+
}
262268
$null = $PSBoundParameters.Remove('ApplicationObject')
263269
break
264270
}
@@ -278,8 +284,12 @@ function New-AzADAppCredential {
278284
}
279285
}
280286
if ($kc) {
287+
[System.Array]$kcList = $app.KeyCredentials
281288
$PSBoundParameters['Id'] = $id
282-
$PSBoundParameters['KeyCredentials'] = $kc
289+
foreach ($k in $kc) {
290+
$kcList += $k
291+
}
292+
$PSBoundParameters['KeyCredentials'] = $kcList
283293
Az.MSGraph.internal\Update-AzADApplication @PSBoundParameters
284294
}
285295
}

src/Resources/MSGraph.Autorest/custom/New-AzADServicePrincipal.ps1

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -297,17 +297,11 @@ function New-AzADServicePrincipal {
297297
# Supports $filter (eq, ne, NOT, ge, le, in, startsWith), $search, and $orderBy.
298298
${DisplayName},
299299

300-
[Parameter(ParameterSetName = 'ApplicationObjectWithPasswordCredentialParameterSet', Mandatory, ValueFromPipeline, HelpMessage = "The application object, could be used as pipeline input.")]
301-
[Parameter(ParameterSetName = 'ApplicationObjectWithKeyCredentialParameterSet', Mandatory, ValueFromPipeline, HelpMessage = "The application object, could be used as pipeline input.")]
302-
[Parameter(ParameterSetName = 'ApplicationObjectWithPasswordPlainParameterSet', Mandatory, ValueFromPipeline, HelpMessage = "The application object, could be used as pipeline input.")]
303-
[Parameter(ParameterSetName = 'ApplicationObjectWithKeyPlainParameterSet', Mandatory, ValueFromPipeline, HelpMessage = "The application object, could be used as pipeline input.")]
300+
[Parameter(ParameterSetName = 'ApplicationObjectParameterSet', Mandatory, ValueFromPipeline, HelpMessage = "The application object, could be used as pipeline input.")]
304301
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
305302
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphApplication]
306303
${ApplicationObject},
307304

308-
[Parameter(ParameterSetName = 'ApplicationWithPasswordCredentialParameterSet', Mandatory)]
309-
[Parameter(ParameterSetName = 'ApplicationWithKeyCredentialParameterSet', Mandatory)]
310-
[Parameter(ParameterSetName = 'ApplicationWithKeyPlainParameterSet', Mandatory)]
311305
[Parameter(ParameterSetName = 'SimpleParameterSet')]
312306
[Alias('AppId')]
313307
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
@@ -341,33 +335,23 @@ function New-AzADServicePrincipal {
341335
# Not nullable.
342336
${ReplyUrl},
343337

344-
[Parameter(ParameterSetName = 'ApplicationWithKeyPlainParameterSet', Mandatory, HelpMessage = "The value of the 'asymmetric' credential type. It represents the base 64 encoded certificate.")]
345-
[Parameter(ParameterSetName = 'ApplicationObjectWithKeyPlainParameterSet', Mandatory, HelpMessage = "The value of the 'asymmetric' credential type. It represents the base 64 encoded certificate.")]
346338
[Parameter(ParameterSetName = 'DisplayNameWithKeyPlainParameterSet', Mandatory, HelpMessage = "The value of the 'asymmetric' credential type. It represents the base 64 encoded certificate.")]
347339
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
348340
[System.String]
349341
${CertValue},
350342

351-
[Parameter(ParameterSetName = 'ApplicationWithKeyPlainParameterSet', HelpMessage = "The effective start date of the credential usage. The default start date value is today. For an 'asymmetric' type credential, this must be set to on or after the date that the X509 certificate is valid from.")]
352-
[Parameter(ParameterSetName = 'ApplicationObjectWithPasswordPlainParameterSet', HelpMessage = "The effective start date of the credential usage. The default start date value is today. For an 'asymmetric' type credential, this must be set to on or after the date that the X509 certificate is valid from.")]
353-
[Parameter(ParameterSetName = 'ApplicationObjectWithKeyPlainParameterSet', HelpMessage = "The effective start date of the credential usage. The default start date value is today. For an 'asymmetric' type credential, this must be set to on or after the date that the X509 certificate is valid from.")]
354343
[Parameter(ParameterSetName = 'DisplayNameWithKeyPlainParameterSet', HelpMessage = "The effective start date of the credential usage. The default start date value is today. For an 'asymmetric' type credential, this must be set to on or after the date that the X509 certificate is valid from.")]
355344
[Parameter(ParameterSetName = 'SimpleParameterSet')]
356345
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
357346
[System.DateTime]
358347
${StartDate},
359348

360-
[Parameter(ParameterSetName = 'ApplicationWithKeyPlainParameterSet', HelpMessage = "The effective end date of the credential usage. The default end date value is one year from today. For an 'asymmetric' type credential, this must be set to on or before the date that the X509 certificate is valid.")]
361-
[Parameter(ParameterSetName = 'ApplicationObjectWithPasswordPlainParameterSet', HelpMessage = "The effective end date of the credential usage. The default end date value is one year from today. For an 'asymmetric' type credential, this must be set to on or before the date that the X509 certificate is valid.")]
362-
[Parameter(ParameterSetName = 'ApplicationObjectWithKeyPlainParameterSet', HelpMessage = "The effective end date of the credential usage. The default end date value is one year from today. For an 'asymmetric' type credential, this must be set to on or before the date that the X509 certificate is valid.")]
363349
[Parameter(ParameterSetName = 'DisplayNameWithKeyPlainParameterSet', HelpMessage = "The effective end date of the credential usage. The default end date value is one year from today. For an 'asymmetric' type credential, this must be set to on or before the date that the X509 certificate is valid.")]
364350
[Parameter(ParameterSetName = 'SimpleParameterSet', HelpMessage = "The effective end date of the credential usage. The default end date value is one year from today. For an 'asymmetric' type credential, this must be set to on or before the date that the X509 certificate is valid.")]
365351
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
366352
[System.DateTime]
367353
${EndDate},
368354

369-
[Parameter(ParameterSetName = 'ApplicationWithKeyCredentialParameterSet', Mandatory, HelpMessage = "key credentials associated with the service principal.")]
370-
[Parameter(ParameterSetName = 'ApplicationObjectWithKeyCredentialParameterSet', Mandatory, HelpMessage = "key credentials associated with the service principal.")]
371355
[Parameter(ParameterSetName = 'DisplayNameWithKeyCredentialParameterSet', Mandatory, HelpMessage = "key credentials associated with the service principal.")]
372356
[AllowEmptyCollection()]
373357
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
@@ -379,8 +363,6 @@ function New-AzADServicePrincipal {
379363
# To construct, see NOTES section for KEYCREDENTIALS properties and create a hash table.
380364
${KeyCredential},
381365

382-
[Parameter(ParameterSetName = 'ApplicationWithPasswordCredentialParameterSet', Mandatory, HelpMessage = "Password credentials associated with the service principal.")]
383-
[Parameter(ParameterSetName = 'ApplicationObjectWithPasswordCredentialParameterSet', Mandatory, HelpMessage = "Password credentials associated with the service principal.")]
384366
[Parameter(ParameterSetName = 'DisplayNameWithPasswordCredentialParameterSet', Mandatory, HelpMessage = "Password credentials associated with the service principal.")]
385367
[AllowEmptyCollection()]
386368
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
@@ -724,7 +706,10 @@ function New-AzADServicePrincipal {
724706
if ($PSBoundParameters['ApplicationObject']) {
725707
$PSBoundParameters['AppId'] = $PSBoundParameters['ApplicationObject'].AppId
726708
$null = $PSBoundParameters.Remove('ApplicationObject')
727-
} elseif (!$PSBoundParameters['ApplicationId']) {
709+
} elseif ($PSBoundParameters['ApplicationId']) {
710+
$PSBoundParameters['AppId'] = $PSBoundParameters['ApplicationId']
711+
$null = $PSBoundParameters.Remove('ApplicationId')
712+
} else {
728713
if (!$PSBoundParameters['DisplayName']) {
729714
$param['DisplayName'] = "azure-powershell-" + (Get-Date).ToString("MM-dd-yyyy-HH-mm-ss")
730715
} else {
@@ -751,13 +736,14 @@ function New-AzADServicePrincipal {
751736
$param['EndDate'] = $PSBoundParameters['EndDate']
752737
$null = $PSBoundParameters.Remove('EndDate')
753738
}
739+
if ($PSBoundParameters['CertValue']) {
740+
$param['CertValue'] = $PSBoundParameters['CertValue']
741+
$null = $PSBoundParameters.Remove('CertValue')
742+
}
754743
}
755744

756745
$app = New-AzADApplication @param
757746
$PSBoundParameters['AppId'] = $app.AppId
758-
} else {
759-
$PSBoundParameters['AppId'] = $PSBoundParameters['ApplicationId']
760-
$null = $PSBoundParameters.Remove('ApplicationId')
761747
}
762748

763749
$sp = Az.MSGraph.internal\New-AzADServicePrincipal @PSBoundParameters

src/Resources/MSGraph.Autorest/custom/New-AzADSpCredential.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ function New-AzADSpCredential {
194194
switch ($PSCmdlet.ParameterSetName) {
195195
{$_ -in 'SpObjectIdWithPasswordParameterSet', 'SpObjectIdWithKeyCredentialParameterSet', 'SpObjectIdWithPasswordCredentialParameterSet', 'SpObjectIdWithCertValueParameterSet'} {
196196
$id = $PSBoundParameters['ObjectId']
197+
if ($kc) {
198+
$sp = Get-AzADServicePrincipal -ObjectId $id
199+
}
197200
$null = $PSBoundParameters.Remove('ObjectId')
198201
break
199202
}
@@ -211,6 +214,9 @@ function New-AzADSpCredential {
211214
}
212215
{$_ -in 'ServicePrincipalObjectWithPasswordParameterSet', 'ServicePrincipalObjectWithKeyCredentialParameterSet', 'ServicePrincipalObjectWithPasswordCredentialParameterSet', 'ServicePrincipalObjectWithCertValueParameterSet'} {
213216
$id = $PSBoundParameters['ServicePrincipalObject'].Id
217+
if ($kc) {
218+
$sp = Get-AzADServicePrincipal -ObjectId $id
219+
}
214220
$null = $PSBoundParameters.Remove('ServicePrincipalObject')
215221
break
216222
}
@@ -230,8 +236,12 @@ function New-AzADSpCredential {
230236
}
231237
}
232238
if ($kc) {
239+
[System.Array]$kcList = $sp.KeyCredentials
233240
$PSBoundParameters['Id'] = $id
234-
$PSBoundParameters['KeyCredentials'] = $kc
241+
foreach ($k in $kc) {
242+
$kcList += $k
243+
}
244+
$PSBoundParameters['KeyCredentials'] = $kcList
235245
Az.MSGraph.internal\Update-AzADServicePrincipal @PSBoundParameters
236246
}
237247
}

src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.MSGraph
3-
Module Guid: 0ce0be77-f0b8-4f48-a526-a42a7e272e07
3+
Module Guid: 0fcdc3b3-bb14-4092-a847-d0cd87a0c25a
44
Download Help Link: https://docs.microsoft.com/powershell/module/az.msgraph
55
Help Version: 1.0.0.0
66
Locale: en-US

0 commit comments

Comments
 (0)