Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[App] Breaking change update Managed Identity #26524

Merged
merged 17 commits into from
Nov 9, 2024
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
2 changes: 2 additions & 0 deletions src/App/App.Autorest/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
license.txt
/*.ps1
/*.psd1
/*.ps1xml
/*.psm1
/*.snk
Expand Down
26 changes: 26 additions & 0 deletions src/App/App.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the ""License"");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an ""AS IS"" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - App")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
40 changes: 16 additions & 24 deletions src/App/App.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ identity-correction-for-post: true
resourcegroup-append: true
nested-object-to-string: true
auto-switch-view: false
disable-transform-identity-type: true
# Disable transform IdentityType as GET+PUT can not replace patch(https://github.com/Azure/autorest.powershell/blob/main/docs/migration-from-v3-to-v4.md#managed-identity-best-practice-alignment)
# 1. ContainerApps_CreateOrUpdate and Jobs_CreateOrUpdate can not update resources
# 2. the input schemas of PUT and PATCH are different
flatten-userassignedidentity: false

use-extension:
"@autorest/powershell": "4.x"
disable-transform-identity-type: true

directive:
- from: swagger-document
Expand Down Expand Up @@ -666,30 +666,22 @@ directive:
- ResourceGroupName
- DomainControlValidation

- where:
verb: New|Update
subject: ContainerApp
hide: true
- where:
verb: New|Update
subject: ContainerAppJob
hide: true
- from: UserAssignedIdentities.dictionary.cs
where: $
transform: $ = $.replace('null != property.Key && null != property.Value', 'null != property.Key');

# This command requires the user to provide the github token, but the command is missing this parameter,
# so the command cannot be used normally. Wait for the next version to fix the problem
- where:
verb: Remove
subject: ContainerAppSourceControl
remove: true

##### announce upcoming MI-related breaking changes
- where:
parameter-name: IdentityType
set:
breaking-change:
change-description: IdentityType will be removed. EnableSystemAssignedIdentity will be used to enable/disable system assigned identity and UserAssignedIdentity will be used to specify user assigned identities.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 13.0.0
change-effective-date: 2024/11/19
- where:
parameter-name: IdentityUserAssignedIdentity
set:
breaking-change:
old-parameter-type: Hashtable
new-parameter-type: string[]
change-description: IdentityUserAssignedIdentity will be renamed to UserAssignedIdentity. And its type will be simplified as string array.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 13.0.0
change-effective-date: 2024/11/19
```
540 changes: 540 additions & 0 deletions src/App/App.Autorest/custom/New-AzContainerApp.ps1

Large diffs are not rendered by default.

472 changes: 472 additions & 0 deletions src/App/App.Autorest/custom/New-AzContainerAppJob.ps1

Large diffs are not rendered by default.

502 changes: 502 additions & 0 deletions src/App/App.Autorest/custom/Update-AzContainerApp.ps1

Large diffs are not rendered by default.

494 changes: 494 additions & 0 deletions src/App/App.Autorest/custom/Update-AzContainerAppJob.ps1

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions src/App/App.Autorest/custom/UserAssignedIdentities.json.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

namespace Microsoft.Azure.PowerShell.Cmdlets.App.Models
{
using Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.Json;
using static Microsoft.Azure.PowerShell.Cmdlets.App.Runtime.Extensions;

/// <summary>
/// Gets or sets a list of key value pairs that describe the set of User Assigned identities that will be used with this volume
/// group. The key is the ARM resource identifier of the identity.
/// </summary>
public partial class UserAssignedIdentities
{
partial void AfterToJson(ref JsonObject container)
{
if (this.__additionalProperties != null)
{
foreach (var key in this.__additionalProperties)
{
if (key.Value == null)
{
container.Add(key.Key, Runtime.Json.XNull.Instance);
}
}
}
}
}
}
77 changes: 38 additions & 39 deletions src/App/App.Autorest/docs/New-AzContainerApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ Create a Container App.
### CreateExpanded (Default)
```
New-AzContainerApp -Name <String> -ResourceGroupName <String> -Location <String> [-SubscriptionId <String>]
[-Configuration <IConfiguration>] [-EnvironmentId <String>] [-ExtendedLocationName <String>]
[-ExtendedLocationType <String>] [-IdentityType <String>] [-IdentityUserAssignedIdentity <Hashtable>]
[-ManagedBy <String>] [-ManagedEnvironmentId <String>] [-ScaleMaxReplica <Int32>] [-ScaleMinReplica <Int32>]
[-Configuration <IConfiguration>] [-EnableSystemAssignedIdentity] [-EnvironmentId <String>]
[-ExtendedLocationName <String>] [-ExtendedLocationType <String>] [-ManagedBy <String>]
[-ManagedEnvironmentId <String>] [-ScaleMaxReplica <Int32>] [-ScaleMinReplica <Int32>]
[-ScaleRule <IScaleRule[]>] [-Tag <Hashtable>] [-TemplateContainer <IContainer[]>]
[-TemplateInitContainer <IInitContainer[]>] [-TemplateRevisionSuffix <String>]
[-TemplateServiceBind <IServiceBind[]>] [-TemplateTerminationGracePeriodSecond <Int64>]
[-TemplateVolume <IVolume[]>] [-WorkloadProfileName <String>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait]
[-Confirm] [-WhatIf] [<CommonParameters>]
[-TemplateVolume <IVolume[]>] [-UserAssignedIdentity <String[]>] [-WorkloadProfileName <String>]
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
```

### CreateViaIdentityExpanded
```
New-AzContainerApp -InputObject <IAppIdentity> -Location <String> [-Configuration <IConfiguration>]
[-EnvironmentId <String>] [-ExtendedLocationName <String>] [-ExtendedLocationType <String>]
[-IdentityType <String>] [-IdentityUserAssignedIdentity <Hashtable>] [-ManagedBy <String>]
[-ManagedEnvironmentId <String>] [-ScaleMaxReplica <Int32>] [-ScaleMinReplica <Int32>]
[-ScaleRule <IScaleRule[]>] [-Tag <Hashtable>] [-TemplateContainer <IContainer[]>]
[-TemplateInitContainer <IInitContainer[]>] [-TemplateRevisionSuffix <String>]
[-TemplateServiceBind <IServiceBind[]>] [-TemplateTerminationGracePeriodSecond <Int64>]
[-TemplateVolume <IVolume[]>] [-WorkloadProfileName <String>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait]
[-Confirm] [-WhatIf] [<CommonParameters>]
[-EnableSystemAssignedIdentity] [-EnvironmentId <String>] [-ExtendedLocationName <String>]
[-ExtendedLocationType <String>] [-ManagedBy <String>] [-ManagedEnvironmentId <String>]
[-ScaleMaxReplica <Int32>] [-ScaleMinReplica <Int32>] [-ScaleRule <IScaleRule[]>] [-Tag <Hashtable>]
[-TemplateContainer <IContainer[]>] [-TemplateInitContainer <IInitContainer[]>]
[-TemplateRevisionSuffix <String>] [-TemplateServiceBind <IServiceBind[]>]
[-TemplateTerminationGracePeriodSecond <Int64>] [-TemplateVolume <IVolume[]>]
[-UserAssignedIdentity <String[]>] [-WorkloadProfileName <String>] [-DefaultProfile <PSObject>] [-AsJob]
[-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
```

### CreateViaJsonFilePath
Expand Down Expand Up @@ -175,11 +175,11 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -EnvironmentId
Resource ID of environment.
### -EnableSystemAssignedIdentity
Determines whether to enable a system-assigned identity for the resource.

```yaml
Type: System.String
Type: System.Management.Automation.SwitchParameter
Parameter Sets: CreateExpanded, CreateViaIdentityExpanded
Aliases:

Expand All @@ -190,8 +190,8 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ExtendedLocationName
The name of the extended location.
### -EnvironmentId
Resource ID of environment.

```yaml
Type: System.String
Expand All @@ -205,8 +205,8 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ExtendedLocationType
The type of the extended location.
### -ExtendedLocationName
The name of the extended location.

```yaml
Type: System.String
Expand All @@ -220,8 +220,8 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -IdentityType
Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
### -ExtendedLocationType
The type of the extended location.

```yaml
Type: System.String
Expand All @@ -235,23 +235,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -IdentityUserAssignedIdentity
The set of user assigned identities associated with the resource.
The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.
The dictionary values can be empty objects ({}) in requests.

```yaml
Type: System.Collections.Hashtable
Parameter Sets: CreateExpanded, CreateViaIdentityExpanded
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -InputObject
Identity Parameter

Expand Down Expand Up @@ -564,6 +547,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -UserAssignedIdentity
The array of user assigned identities associated with the resource.
The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.'

```yaml
Type: System.String[]
Parameter Sets: CreateExpanded, CreateViaIdentityExpanded
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -WorkloadProfileName
Workload profile name to pin for container app execution.

Expand Down
Loading