Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/Resources/MSGraph.Autorest/custom/New-AzADAppCredential.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ function New-AzADAppCredential {
switch ($PSCmdlet.ParameterSetName) {
{ $_ -in 'ApplicationObjectIdWithPasswordParameterSet', 'ApplicationObjectIdWithKeyCredentialParameterSet', 'ApplicationObjectIdWithPasswordCredentialParameterSet', 'ApplicationObjectIdWithCertValueParameterSet'} {
$id = $PSBoundParameters['ObjectId']
if ($kc) {
$app = Get-AzADApplication -ObjectId $id
}
$null = $PSBoundParameters.Remove('ObjectId')
break
}
Expand Down Expand Up @@ -259,6 +262,9 @@ function New-AzADAppCredential {
}
{ $_ -in 'ApplicationObjectWithPasswordParameterSet', 'ApplicationObjectWithKeyCredentialParameterSet', 'ApplicationObjectWithPasswordCredentialParameterSet', 'ApplicationObjectWithCertValueParameterSet'} {
$id = $PSBoundParameters['ApplicationObject'].Id
if ($kc) {
$app = Get-AzADApplication -ObjectId $id
}
$null = $PSBoundParameters.Remove('ApplicationObject')
break
}
Expand All @@ -278,8 +284,12 @@ function New-AzADAppCredential {
}
}
if ($kc) {
[System.Array]$kcList = $app.KeyCredentials
$PSBoundParameters['Id'] = $id
$PSBoundParameters['KeyCredentials'] = $kc
foreach ($k in $kc) {
$kcList += $k
}
$PSBoundParameters['KeyCredentials'] = $kcList
Az.MSGraph.internal\Update-AzADApplication @PSBoundParameters
}
}
Expand Down
32 changes: 9 additions & 23 deletions src/Resources/MSGraph.Autorest/custom/New-AzADServicePrincipal.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,11 @@ function New-AzADServicePrincipal {
# Supports $filter (eq, ne, NOT, ge, le, in, startsWith), $search, and $orderBy.
${DisplayName},

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

[Parameter(ParameterSetName = 'ApplicationWithPasswordCredentialParameterSet', Mandatory)]
[Parameter(ParameterSetName = 'ApplicationWithKeyCredentialParameterSet', Mandatory)]
[Parameter(ParameterSetName = 'ApplicationWithKeyPlainParameterSet', Mandatory)]
[Parameter(ParameterSetName = 'SimpleParameterSet')]
[Alias('AppId')]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
Expand Down Expand Up @@ -341,33 +335,23 @@ function New-AzADServicePrincipal {
# Not nullable.
${ReplyUrl},

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

[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.")]
[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.")]
[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.")]
[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.")]
[Parameter(ParameterSetName = 'SimpleParameterSet')]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.DateTime]
${StartDate},

[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.")]
[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.")]
[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.")]
[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.")]
[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.")]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.DateTime]
${EndDate},

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

[Parameter(ParameterSetName = 'ApplicationWithPasswordCredentialParameterSet', Mandatory, HelpMessage = "Password credentials associated with the service principal.")]
[Parameter(ParameterSetName = 'ApplicationObjectWithPasswordCredentialParameterSet', Mandatory, HelpMessage = "Password credentials associated with the service principal.")]
[Parameter(ParameterSetName = 'DisplayNameWithPasswordCredentialParameterSet', Mandatory, HelpMessage = "Password credentials associated with the service principal.")]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
Expand Down Expand Up @@ -724,7 +706,10 @@ function New-AzADServicePrincipal {
if ($PSBoundParameters['ApplicationObject']) {
$PSBoundParameters['AppId'] = $PSBoundParameters['ApplicationObject'].AppId
$null = $PSBoundParameters.Remove('ApplicationObject')
} elseif (!$PSBoundParameters['ApplicationId']) {
} elseif ($PSBoundParameters['ApplicationId']) {
$PSBoundParameters['AppId'] = $PSBoundParameters['ApplicationId']
$null = $PSBoundParameters.Remove('ApplicationId')
} else {
if (!$PSBoundParameters['DisplayName']) {
$param['DisplayName'] = "azure-powershell-" + (Get-Date).ToString("MM-dd-yyyy-HH-mm-ss")
} else {
Expand All @@ -751,13 +736,14 @@ function New-AzADServicePrincipal {
$param['EndDate'] = $PSBoundParameters['EndDate']
$null = $PSBoundParameters.Remove('EndDate')
}
if ($PSBoundParameters['CertValue']) {
$param['CertValue'] = $PSBoundParameters['CertValue']
$null = $PSBoundParameters.Remove('CertValue')
}
}

$app = New-AzADApplication @param
$PSBoundParameters['AppId'] = $app.AppId
} else {
$PSBoundParameters['AppId'] = $PSBoundParameters['ApplicationId']
$null = $PSBoundParameters.Remove('ApplicationId')
}

$sp = Az.MSGraph.internal\New-AzADServicePrincipal @PSBoundParameters
Expand Down
12 changes: 11 additions & 1 deletion src/Resources/MSGraph.Autorest/custom/New-AzADSpCredential.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ function New-AzADSpCredential {
switch ($PSCmdlet.ParameterSetName) {
{$_ -in 'SpObjectIdWithPasswordParameterSet', 'SpObjectIdWithKeyCredentialParameterSet', 'SpObjectIdWithPasswordCredentialParameterSet', 'SpObjectIdWithCertValueParameterSet'} {
$id = $PSBoundParameters['ObjectId']
if ($kc) {
$sp = Get-AzADServicePrincipal -ObjectId $id
}
$null = $PSBoundParameters.Remove('ObjectId')
break
}
Expand All @@ -211,6 +214,9 @@ function New-AzADSpCredential {
}
{$_ -in 'ServicePrincipalObjectWithPasswordParameterSet', 'ServicePrincipalObjectWithKeyCredentialParameterSet', 'ServicePrincipalObjectWithPasswordCredentialParameterSet', 'ServicePrincipalObjectWithCertValueParameterSet'} {
$id = $PSBoundParameters['ServicePrincipalObject'].Id
if ($kc) {
$sp = Get-AzADServicePrincipal -ObjectId $id
}
$null = $PSBoundParameters.Remove('ServicePrincipalObject')
break
}
Expand All @@ -230,8 +236,12 @@ function New-AzADSpCredential {
}
}
if ($kc) {
[System.Array]$kcList = $sp.KeyCredentials
$PSBoundParameters['Id'] = $id
$PSBoundParameters['KeyCredentials'] = $kc
foreach ($k in $kc) {
$kcList += $k
}
$PSBoundParameters['KeyCredentials'] = $kcList
Az.MSGraph.internal\Update-AzADServicePrincipal @PSBoundParameters
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.MSGraph
Module Guid: 0ce0be77-f0b8-4f48-a526-a42a7e272e07
Module Guid: 0fcdc3b3-bb14-4092-a847-d0cd87a0c25a
Download Help Link: https://docs.microsoft.com/powershell/module/az.msgraph
Help Version: 1.0.0.0
Locale: en-US
Expand Down
Loading