Skip to content

Commit

Permalink
Generation of API version 2022-01-31-PREVIEW for Managed Service Iden…
Browse files Browse the repository at this point in the history
…tities (#19417)

Co-authored-by: Igor Solenov <igorsolenov@microdoft.com>
  • Loading branch information
isolenov and Igor Solenov authored Sep 7, 2022
1 parent 08815e8 commit 91d460d
Show file tree
Hide file tree
Showing 46 changed files with 2,444 additions and 209 deletions.
4 changes: 2 additions & 2 deletions src/ManagedServiceIdentity/Az.ManagedServiceIdentity.psd1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@{
GUID = '1f09fbda-2563-4cfc-9098-100c27b52fa1'
RootModule = './Az.ManagedServiceIdentity.psm1'
ModuleVersion = '0.1.0'
ModuleVersion = '0.2.0'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Expand All @@ -11,7 +11,7 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.ManagedServiceIdentity.private.dll'
FormatsToProcess = './Az.ManagedServiceIdentity.format.ps1xml'
FunctionsToExport = 'Get-AzSystemAssignedIdentity', 'Get-AzUserAssignedIdentity', 'New-AzUserAssignedIdentity', 'Remove-AzUserAssignedIdentity', 'Update-AzUserAssignedIdentity', '*'
FunctionsToExport = 'Get-AzFederatedIdentityCredentials', 'Get-AzSystemAssignedIdentity', 'Get-AzUserAssignedIdentity', 'Get-AzUserAssignedIdentityAssociatedResource', 'New-AzFederatedIdentityCredentials', 'New-AzUserAssignedIdentity', 'Remove-AzFederatedIdentityCredentials', 'Remove-AzUserAssignedIdentity', 'Update-AzFederatedIdentityCredentials', 'Update-AzUserAssignedIdentity', '*'
AliasesToExport = '*'
PrivateData = @{
PSData = @{
Expand Down
80 changes: 77 additions & 3 deletions src/ManagedServiceIdentity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This directory contains the PowerShell module for the ManagedServiceIdentity ser
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.

## Module Requirements
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater

## Authentication
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
Expand All @@ -30,20 +30,22 @@ For information on how to develop for `Az.ManagedServiceIdentity`, see [how-to.m
> see https://aka.ms/autorest
``` yaml
branch: 476564a1aa6ddb38ec681c9f89d42f00c1becd25
branch: main
require:
- $(this-folder)/../readme.azure.noprofile.md
input-file:
- $(repo)/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2018-11-30/ManagedIdentity.json
- $(repo)/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/ManagedIdentity.json

subject-prefix: ""
resourcegroup-append: true
nested-object-to-string: true
identity-correction-for-post: true
module-version: 0.2.0

directive:
- where:
verb: Set
subject: SystemAssignedIdentity|UserAssignedIdentity
remove: true

- where:
Expand All @@ -62,4 +64,76 @@ directive:
parameter-name: ResourceName
set:
parameter-name: Name

# Associated Resources

- where:
subject: UserAssignedIdentityAssociatedResource
parameter-name: ResourceName
set:
parameter-name: Name

- where:
subject: UserAssignedIdentityAssociatedResource
set:
preview-message: This is a preview version of the Associated Resources feature.

# Federated identity credentials

- where:
verb: Set
subject: FederatedIdentityCredentials
set:
verb: Update
subject: FederatedIdentityCredentials

- where:
subject: FederatedIdentityCredentials
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
remove: true

- where:
subject: FederatedIdentityCredentials
parameter-name: ResourceName
set:
parameter-name: IdentityName

- where:
subject: FederatedIdentityCredentials
parameter-name: FederatedIdentityCredentialResourceName
set:
parameter-name: Name

- where:
subject: FederatedIdentityCredentials
parameter-name: Audience
required: true
set:
default:
script: '@("api://AzureADTokenExchange")'

- where:
subject: FederatedIdentityCredentials
parameter-name: Issuer
required: true

- where:
subject: FederatedIdentityCredentials
parameter-name: Subject
required: true

- where:
model-name: FederatedIdentityCredential
set:
format-table:
properties:
- Name
- Issuer
- Subject
- Audience

- where:
subject: FederatedIdentityCredentials
set:
preview-message: This is a preview version of the Federated Identity Credentials feature.
```
9 changes: 9 additions & 0 deletions src/ManagedServiceIdentity/custom/AzureResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.Models.Api20220131Preview
{
/// <summary>Customizations of AzureResource</summary>
public partial class AzureResource
{
/// <summary>Property revealing 'Type' in response table.</summary>
public string ResourceType { get => this.Type; }
}
}
8 changes: 4 additions & 4 deletions src/ManagedServiceIdentity/custom/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Custom
This directory contains custom implementation for non-generated cmdlets for the `Az.ManagedServiceIdentity` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.ManagedServiceIdentity.custom.psm1`. This file should not be modified.
This directory contains custom implementation for non-generated cmdlets for the `Az.ManagedServiceIdentity` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.ManagedServiceIdentity.custom.psm1`. This file should not be modified.

## Info
- Modifiable: yes
Expand All @@ -15,10 +15,10 @@ For C# cmdlets, they are compiled with the rest of the generated low-level cmdle
For script cmdlets, these are loaded via the `Az.ManagedServiceIdentity.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.

## Purpose
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder.
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder.

## Usage
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
- Break
- DefaultProfile
- HttpPipelineAppend
Expand All @@ -36,6 +36,6 @@ For processing the cmdlets, we've created some additional attributes:
- `Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.ManagedServiceIdentity`.
- `Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.InternalExportAttribute`
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.ManagedServiceIdentity`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
- Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.ManagedServiceIdentity`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
- `Microsoft.Azure.PowerShell.Cmdlets.ManagedServiceIdentity.ProfileAttribute`
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
15 changes: 15 additions & 0 deletions src/ManagedServiceIdentity/docs/Az.ManagedServiceIdentity.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,33 @@ Locale: en-US
Microsoft Azure PowerShell: ManagedServiceIdentity cmdlets

## Az.ManagedServiceIdentity Cmdlets
### [Get-AzFederatedIdentityCredentials](Get-AzFederatedIdentityCredentials.md)
Gets the federated identity credential.

### [Get-AzSystemAssignedIdentity](Get-AzSystemAssignedIdentity.md)
Gets the systemAssignedIdentity available under the specified RP scope.

### [Get-AzUserAssignedIdentity](Get-AzUserAssignedIdentity.md)
Gets the identity.

### [Get-AzUserAssignedIdentityAssociatedResource](Get-AzUserAssignedIdentityAssociatedResource.md)
Lists the associated resources for this identity.

### [New-AzFederatedIdentityCredentials](New-AzFederatedIdentityCredentials.md)
Create or update a federated identity credential under the specified user assigned identity.

### [New-AzUserAssignedIdentity](New-AzUserAssignedIdentity.md)
Create or update an identity in the specified subscription and resource group.

### [Remove-AzFederatedIdentityCredentials](Remove-AzFederatedIdentityCredentials.md)
Deletes the federated identity credential.

### [Remove-AzUserAssignedIdentity](Remove-AzUserAssignedIdentity.md)
Deletes the identity.

### [Update-AzFederatedIdentityCredentials](Update-AzFederatedIdentityCredentials.md)
Create or update a federated identity credential under the specified user assigned identity.

### [Update-AzUserAssignedIdentity](Update-AzUserAssignedIdentity.md)
Update an identity in the specified subscription and resource group.

Loading

0 comments on commit 91d460d

Please sign in to comment.