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: 8 additions & 4 deletions src/Resources/Authorization.Autorest/create-model-cmdlets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ function CreateModelCmdlet {
}

$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
$ModuleName = ''
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
$null = New-Item -ItemType Directory -Force -Path $OutputDir
if ('Az.Resources'.length -gt 0) {
$ModuleName = 'Az.Resources'
} else {
$ModuleName = 'Az.Authorization'
}

$CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs
$Content = ''
Expand Down Expand Up @@ -64,10 +68,10 @@ function CreateModelCmdlet {
$ObjectType = $Model
$ObjectTypeWithNamespace = "${Namespace}.${ObjectType}"
# remove duplicated module name
if ($ObjectType.StartsWith($ModuleName)) {
if ($ObjectType.StartsWith('')) {
$ModulePrefix = ''
} else {
$ModulePrefix = $ModuleName
$ModulePrefix = ''
}
$OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir

Expand Down Expand Up @@ -158,7 +162,7 @@ Create an in-memory object for ${ObjectType}.
.Outputs
${ObjectTypeWithNamespace}
.Link
https://learn.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
https://learn.microsoft.com/powershell/module/${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
#>
function New-Az${ModulePrefix}${ObjectType}Object {
[OutputType('${ObjectTypeWithNamespace}')]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.Authorization
Module Guid: 6fd3fa0e-907d-4510-9563-4edf3773736d
Module Guid: 5d67217e-5bcb-4c75-80ab-67f60154a5b2
Download Help Link: https://learn.microsoft.com/powershell/module/az.authorization
Help Version: 1.0.0.0
Locale: en-US
Expand Down
10 changes: 5 additions & 5 deletions src/Resources/Authorization.Autorest/generate-info.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"swagger_commit": "2278f5552561a7959a49a1e38cb7ddbb349d1589",
"autorest_core": "3.9.3",
"node": "v14.15.5",
"autorest_modelerfour": "4.15.414",
"autorest_powershell": "3.0.498",
"autorest": "`-- (empty)"
"autorest_powershell": "3.0.502",
"autorest_core": "3.9.4",
"swagger_commit": "b187f8bbf2171697f327ad16577c1b9cba2ef18e",
"autorest": "`-- (empty)",
"autorest_modelerfour": "4.15.414"
}
7 changes: 6 additions & 1 deletion src/Resources/MSGraph.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ directive:
- where:
subject: UserSigned$
hide: true

- where:
parameter-name: AccountEnabled
verb: Update
subject: User
set:
parameter-description: "true for enabling the account; otherwise, false. Always true when combined with `-Password`. `-AccountEnabled $false` is ignored when changing the account's password."
- where:
verb: Get
variant: ^List(.*)
Expand Down
12 changes: 8 additions & 4 deletions src/Resources/MSGraph.Autorest/create-model-cmdlets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ function CreateModelCmdlet {
}

$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
$ModuleName = 'AD'
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
$null = New-Item -ItemType Directory -Force -Path $OutputDir
if ('Az.Resources'.length -gt 0) {
$ModuleName = 'Az.Resources'
} else {
$ModuleName = 'Az.MSGraph'
}

$CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs
$Content = ''
Expand Down Expand Up @@ -64,10 +68,10 @@ function CreateModelCmdlet {
$ObjectType = $Model
$ObjectTypeWithNamespace = "${Namespace}.${ObjectType}"
# remove duplicated module name
if ($ObjectType.StartsWith($ModuleName)) {
if ($ObjectType.StartsWith('AD')) {
$ModulePrefix = ''
} else {
$ModulePrefix = $ModuleName
$ModulePrefix = 'AD'
}
$OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir

Expand Down Expand Up @@ -158,7 +162,7 @@ Create an in-memory object for ${ObjectType}.
.Outputs
${ObjectTypeWithNamespace}
.Link
https://learn.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
https://learn.microsoft.com/powershell/module/${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
#>
function New-Az${ModulePrefix}${ObjectType}Object {
[OutputType('${ObjectTypeWithNamespace}')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Get federatedIdentityCredentials by Id from applications.
.Description
Get federatedIdentityCredentials by Id from applications.
.Link
https://learn.microsoft.com/powershell/module/az.resources/get-azadappfederatedidentitycredentials
https://learn.microsoft.com/powershell/module/az.resources/get-azadappfederatedcredential
#>
function Get-AzADAppFederatedCredential {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphFederatedIdentityCredential])]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Create federatedIdentityCredential for applications.
.Description
Create federatedIdentityCredential for applications.
.Link
https://learn.microsoft.com/powershell/module/az.resources/new-azadappfederatedidentitycredential
https://learn.microsoft.com/powershell/module/az.resources/new-azadappfederatedcredential
#>
function New-AzADAppFederatedCredential {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphFederatedIdentityCredential])]
Expand Down
7 changes: 6 additions & 1 deletion src/Resources/MSGraph.Autorest/custom/Update-AzADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,16 @@ function Update-AzADUser {
[System.Boolean]
[Alias('EnableAccount')]
# true for enabling the account; otherwise, false.
# Always true when combined with `-Password`.
# `-AccountEnabled $false` is ignored when changing the account's password.
${AccountEnabled},

[Parameter()]
[SecureString]
# Password for the user. It must meet the tenant's password complexity requirements. It is recommended to set a strong password.
# The password for the user. This property is required when a user is created.
# It can be updated, but the user will be required to change the password on the next login.
# The password must satisfy minimum requirements as speci./fied by the user's passwordPolicies property.
# By default, a strong password is required. When changing the password using this method, AccountEnabled is set to true.
${Password},

[Parameter()]
Expand Down
13 changes: 10 additions & 3 deletions src/Resources/MSGraph.Autorest/docs/Update-AzADUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Update user by user principal name

### -AccountEnabled
true for enabling the account; otherwise, false.
Always true when combined with `-Password`.
`-AccountEnabled $false` is ignored when changing the account's password.

```yaml
Type: System.Boolean
Expand Down Expand Up @@ -585,9 +587,14 @@ Accept wildcard characters: False
```

### -Password
Password for the user.
It must meet the tenant's password complexity requirements.
It is recommended to set a strong password.
The password for the user.
This property is required when a user is created.

It can be updated, but the user will be required to change the password on the next login.

The password must satisfy minimum requirements as speci./fied by the user's passwordPolicies property.
By default, a strong password is required.
When changing the password using this method, AccountEnabled is set to true.

```yaml
Type: System.Security.SecureString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ APPLICATIONOBJECT <MicrosoftGraphApplication>: application object
[DeletedDateTime <DateTime?>]: Date and time when this object was deleted. Always null when the object hasn't been deleted.
[DisplayName <String>]: The name displayed in directory
.Link
https://learn.microsoft.com/powershell/module/az.resources/get-azadappfederatedidentitycredentials
https://learn.microsoft.com/powershell/module/az.resources/get-azadappfederatedcredential
#>
function Get-AzADAppFederatedCredential {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphFederatedIdentityCredential])]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ New-AzADAppFederatedCredential -ApplicationObjectId $appObjectId -Audience api:/
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphFederatedIdentityCredential
.Link
https://learn.microsoft.com/powershell/module/az.resources/new-azadappfederatedidentitycredential
https://learn.microsoft.com/powershell/module/az.resources/new-azadappfederatedcredential
#>
function New-AzADAppFederatedCredential {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphFederatedIdentityCredential])]
Expand Down
17 changes: 12 additions & 5 deletions src/Resources/MSGraph.Autorest/exports/ProxyCmdletDefinitions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@ APPLICATIONOBJECT <MicrosoftGraphApplication>: application object
[DeletedDateTime <DateTime?>]: Date and time when this object was deleted. Always null when the object hasn't been deleted.
[DisplayName <String>]: The name displayed in directory
.Link
https://learn.microsoft.com/powershell/module/az.resources/get-azadappfederatedidentitycredentials
https://learn.microsoft.com/powershell/module/az.resources/get-azadappfederatedcredential
#>
function Get-AzADAppFederatedCredential {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphFederatedIdentityCredential])]
Expand Down Expand Up @@ -4317,7 +4317,7 @@ New-AzADAppFederatedCredential -ApplicationObjectId $appObjectId -Audience api:/
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphFederatedIdentityCredential
.Link
https://learn.microsoft.com/powershell/module/az.resources/new-azadappfederatedidentitycredential
https://learn.microsoft.com/powershell/module/az.resources/new-azadappfederatedcredential
#>
function New-AzADAppFederatedCredential {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphFederatedIdentityCredential])]
Expand Down Expand Up @@ -10950,14 +10950,21 @@ param(
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.Boolean]
# true for enabling the account; otherwise, false.
# Always true when combined with `-Password`.
# `-AccountEnabled $false` is ignored when changing the account's password.
${AccountEnabled},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.Security.SecureString]
# Password for the user.
# It must meet the tenant's password complexity requirements.
# It is recommended to set a strong password.
# The password for the user.
# This property is required when a user is created.
#
# It can be updated, but the user will be required to change the password on the next login.
#
# The password must satisfy minimum requirements as speci./fied by the user's passwordPolicies property.
# By default, a strong password is required.
# When changing the password using this method, AccountEnabled is set to true.
${Password},

[Parameter()]
Expand Down
13 changes: 10 additions & 3 deletions src/Resources/MSGraph.Autorest/exports/Update-AzADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,21 @@ param(
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.Boolean]
# true for enabling the account; otherwise, false.
# Always true when combined with `-Password`.
# `-AccountEnabled $false` is ignored when changing the account's password.
${AccountEnabled},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.Security.SecureString]
# Password for the user.
# It must meet the tenant's password complexity requirements.
# It is recommended to set a strong password.
# The password for the user.
# This property is required when a user is created.
#
# It can be updated, but the user will be required to change the password on the next login.
#
# The password must satisfy minimum requirements as speci./fied by the user's passwordPolicies property.
# By default, a strong password is required.
# When changing the password using this method, AccountEnabled is set to true.
${Password},

[Parameter()]
Expand Down
10 changes: 5 additions & 5 deletions src/Resources/MSGraph.Autorest/generate-info.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"swagger_commit": "2278f5552561a7959a49a1e38cb7ddbb349d1589",
"autorest_core": "3.9.3",
"node": "v14.15.5",
"autorest_modelerfour": "4.15.414",
"autorest_powershell": "3.0.498",
"autorest": "`-- (empty)"
"autorest_powershell": "3.0.502",
"autorest_core": "3.9.4",
"swagger_commit": "b187f8bbf2171697f327ad16577c1b9cba2ef18e",
"autorest": "`-- (empty)",
"autorest_modelerfour": "4.15.414"
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public partial class UpdateAzADUser_UpdateExpanded : global::System.Management.A
private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource();

/// <summary>
/// true if the account is enabled; otherwise, false. This property is required when a user is created. Supports $filter (eq,
/// ne, NOT, and in).
/// true for enabling the account; otherwise, false. Always true when combined with `-Password`. `-AccountEnabled $false`
/// is ignored when changing the account's password.
/// </summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "true if the account is enabled; otherwise, false. This property is required when a user is created. Supports $filter (eq, ne, NOT, and in).")]
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "true for enabling the account; otherwise, false. Always true when combined with `-Password`. `-AccountEnabled $false` is ignored when changing the account's password.")]
[global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Body)]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"true if the account is enabled; otherwise, false. This property is required when a user is created. Supports $filter (eq, ne, NOT, and in).",
Description = @"true for enabling the account; otherwise, false. Always true when combined with `-Password`. `-AccountEnabled $false` is ignored when changing the account's password.",
SerializedName = @"accountEnabled",
PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })]
public global::System.Management.Automation.SwitchParameter AccountEnabled { get => _body.AccountEnabled ?? default(global::System.Management.Automation.SwitchParameter); set => _body.AccountEnabled = value; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7361,9 +7361,9 @@ param(
[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.Management.Automation.SwitchParameter]
# true if the account is enabled; otherwise, false.
# This property is required when a user is created.
# Supports $filter (eq, ne, NOT, and in).
# true for enabling the account; otherwise, false.
# Always true when combined with `-Password`.
# `-AccountEnabled $false` is ignored when changing the account's password.
${AccountEnabled},

[Parameter()]
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/MSGraph.Autorest/internal/Update-AzADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ param(
[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.Management.Automation.SwitchParameter]
# true if the account is enabled; otherwise, false.
# This property is required when a user is created.
# Supports $filter (eq, ne, NOT, and in).
# true for enabling the account; otherwise, false.
# Always true when combined with `-Password`.
# `-AccountEnabled $false` is ignored when changing the account's password.
${AccountEnabled},

[Parameter()]
Expand Down
8 changes: 5 additions & 3 deletions src/Resources/Resources/Az.Resources.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 2023/2/3
# Generated on: 3/1/2023
#

@{
Expand Down Expand Up @@ -224,7 +224,9 @@ PrivateData = @{
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'Azure','ResourceManager','ARM','Provider','ResourceGroup','Deployment','ActiveDirectory','Authorization','Management','ManagementGroups','Tags'
Tags = 'Azure', 'ResourceManager', 'ARM', 'Provider', 'ResourceGroup',
'Deployment', 'ActiveDirectory', 'Authorization', 'Management',
'ManagementGroups', 'Tags'

# A URL to the license for this module.
LicenseUri = 'https://aka.ms/azps-license'
Expand All @@ -250,7 +252,7 @@ PrivateData = @{

} # End of PSData hashtable

} # End of PrivateData hashtable
} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''
Expand Down
32 changes: 15 additions & 17 deletions src/Resources/Resources/help/New-AzADAppCredential.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,30 +122,28 @@ Creates key credentials or password credentials for an application.

## EXAMPLES

### Example 1: Create key credentials for an application

### Example 1: Create key credentials for application
```powershell
# $ObjectId should be the the 'Object ID' GUID associated with the Azure app registration.
# $CertificateThumbprint should be the thumbprint of the certificate.
# $Cert is the base64 encoded content of the certificate.
$ObjectId = "00000000-0000-0000-0000-000000000000"
$Credential = New-Object -TypeName `
"Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphKeyCredential" `
-Property @{'Key' = $Cert;
'Usage' = 'Verify';
'Type' = 'AsymmetricX509Cert'
}
New-AzADAppCredential -ObjectId $ObjectId -KeyCredentials $Credential -CustomKeyIdentifier $CertificateThumbprint
# ObjectId is the string representation of a GUID for directory object, application, in Azure AD.
$Id = "00000000-0000-0000-0000-000000000000"
# $cert is Base64 encoded content of certificate
$credential = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphKeyCredential" `
-Property @{'Key' = $cert;
'Usage' = 'Verify';
'Type' = 'AsymmetricX509Cert'
}
New-AzADAppCredential -ObjectId $Id -KeyCredentials $credential
```

### Example 2: Create password credentials for an application
Create key credentials for application with object Id $Id

### Example 2: Create password credentials for application
```powershell
# $ApplicationId` should be the the 'Application ID' GUID associated with the Azure app registration.
$ApplicationId = "00000000-0000-0000-0000-000000000000"
Get-AzADApplication -ApplicationId $ApplicationId | New-AzADAppCredential -StartDate $startDate -EndDate $endDate
# ApplicationId is AppId of Application object which is different from directory id in Azure AD.
Get-AzADApplication -ApplicationId $appId | New-AzADAppCredential -StartDate $startDate -EndDate $endDate
```

Create password credentials for application

## PARAMETERS

Expand Down
Loading