Skip to content

Commit

Permalink
[Fleet] Managed Identity upgrade (#24643)
Browse files Browse the repository at this point in the history
* Upgrade Fleet managed Identity design Add example and test

* Fix update description
  • Loading branch information
JoyerJin authored Apr 23, 2024
1 parent 361a813 commit 0b1f7d9
Show file tree
Hide file tree
Showing 16 changed files with 1,855 additions and 1,232 deletions.
22 changes: 8 additions & 14 deletions src/Fleet/Fleet.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,12 @@ require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
- $(repo)/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md

title: Fleet
module-version: 0.1.0
subject-prefix: $(service-name)
disable-transform-identity-type: true
flatten-userassignedidentity: false

directive:
# # # Following is two common directive which are normally required in all the RPs
# # # 1. Remove the unexpanded parameter set
# # # 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
- where:
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true
# Fix required parameter missing
- from: swagger-document
where: $.definitions.FleetMember
Expand Down Expand Up @@ -74,15 +66,17 @@ directive:
- from: swagger-document
where: $.definitions.NodeImageSelection.properties.type
transform: $['x-ms-mutability'] = ["read", "update", "create"]
# # # Following is two common directive which are normally required in all the RPs
# # # 1. Remove the unexpanded parameter set
# # # 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
- where:
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true
# Hide set cmdlet
- where:
verb: Set
remove: true
# Rename IdentityUserAssignedIdentity, UpdateStrategyName
- where:
parameter-name: IdentityUserAssignedIdentity
set:
parameter-name: UserAssignedIdentity
# Rename UpdateStrategyName
- where:
parameter-name: UpdateStrategyName
subject: FleetUpdateStrategy
Expand Down
6 changes: 3 additions & 3 deletions src/Fleet/Fleet.Autorest/docs/Az.Fleet.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ Starts an UpdateRun.
Stops an UpdateRun.

### [Update-AzFleet](Update-AzFleet.md)
Update a Fleet
Update a Fleet.

### [Update-AzFleetMember](Update-AzFleetMember.md)
Update a FleetMember

### [Update-AzFleetUpdateRun](Update-AzFleetUpdateRun.md)
Create a UpdateRun
Update a UpdateRun

### [Update-AzFleetUpdateStrategy](Update-AzFleetUpdateStrategy.md)
Create a FleetUpdateStrategy
Update a FleetUpdateStrategy

90 changes: 78 additions & 12 deletions src/Fleet/Fleet.Autorest/docs/New-AzFleet.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ Create a Fleet.
### CreateExpanded (Default)
```
New-AzFleet -Name <String> -ResourceGroupName <String> -Location <String> [-SubscriptionId <String>]
[-IfMatch <String>] [-IfNoneMatch <String>] [-IdentityType <String>] [-Tag <Hashtable>]
[-UserAssignedIdentity <Hashtable>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf]
[-IfMatch <String>] [-IfNoneMatch <String>] [-EnableSystemAssignedIdentity] [-Tag <Hashtable>]
[-UserAssignedIdentity <String[]>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf]
[<CommonParameters>]
```

### CreateViaIdentityExpanded
```
New-AzFleet -InputObject <IFleetIdentity> -Location <String> [-IfMatch <String>] [-IfNoneMatch <String>]
[-IdentityType <String>] [-Tag <Hashtable>] [-UserAssignedIdentity <Hashtable>] [-DefaultProfile <PSObject>]
[-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
[-EnableSystemAssignedIdentity] [-Tag <Hashtable>] [-UserAssignedIdentity <String[]>]
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
```

### CreateViaJsonFilePath
Expand All @@ -46,7 +46,7 @@ Create a Fleet.

## EXAMPLES

### Example 1: Creates a Fleet resource
### Example 1: Creates a Fleet resource with none identity type
```powershell
New-AzFleet -Name sss -ResourceGroupName ps1-test -Location eastus
```
Expand Down Expand Up @@ -74,6 +74,73 @@ Tag : {
Type : Microsoft.ContainerService/fleets
```

This command creates a Fleet resource with none identity type.

### Example 2: Creates a Fleet resource with EnableSystemAssignedIdentity
```powershell
New-AzFleet -Name testfleet02 -ResourceGroupName joyer-test -Location eastus -Tag @{"456"="asd"} -EnableSystemAssignedIdentity
```

```output
ETag : "0a006dc9-0000-0100-0000-661cd4f70000"
Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.ContainerService/fleets/testfleet02
IdentityPrincipalId : 978528a9-fa0f-4cdb-8282-95b3b30bb883
IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47
IdentityType : SystemAssigned
IdentityUserAssignedIdentity : {
}
Location : eastus
Name : testfleet02
ProvisioningState : Succeeded
ResourceGroupName : joyer-test
SystemDataCreatedAt : 4/15/2024 7:19:15 AM
SystemDataCreatedBy : v-jiaji@microsoft.com
SystemDataCreatedByType : User
SystemDataLastModifiedAt : 4/15/2024 7:19:15 AM
SystemDataLastModifiedBy : v-jiaji@microsoft.com
SystemDataLastModifiedByType : User
Tag : {
"456": "asd"
}
Type : Microsoft.ContainerService/fleets
```

This command creates a Fleet resource with system assigned identity type.

### Example 3: Creates a Fleet resource with user assigned identity type
```powershell
$mi = Get-AzUserAssignedIdentity -Name testUserAssignedMI -ResourceGroupName joyer-test
New-AzFleet -Name testfleet03 -ResourceGroupName joyer-test -Location eastus -Tag @{"789"="asd"} -UserAssignedIdentity $mi.Id
```

```output
ETag : "0a00e0c9-0000-0100-0000-661cd8010000"
Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.ContainerService/fleets/testflee
t03
IdentityPrincipalId :
IdentityTenantId :
IdentityType : UserAssigned
IdentityUserAssignedIdentity : {
"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/Microsoft.ManagedIdentity/userAssignedI
dentities/testUserAssignedMI": {
}
}
Location : eastus
Name : testfleet03
ProvisioningState : Succeeded
ResourceGroupName : joyer-test
SystemDataCreatedAt : 4/15/2024 7:32:16 AM
SystemDataCreatedBy : v-jiaji@microsoft.com
SystemDataCreatedByType : User
SystemDataLastModifiedAt : 4/15/2024 7:32:16 AM
SystemDataLastModifiedBy : v-jiaji@microsoft.com
SystemDataLastModifiedByType : User
Tag : {
"789": "asd"
}
Type : Microsoft.ContainerService/fleets
```

This command creates a Fleet resource with a long running operation.

## PARAMETERS
Expand Down Expand Up @@ -109,11 +176,11 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -IdentityType
Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
### -EnableSystemAssignedIdentity
Decides if enable a system assigned identity for the resource.
```yaml
Type: System.String
Type: System.Management.Automation.SwitchParameter
Parameter Sets: CreateExpanded, CreateViaIdentityExpanded
Aliases:

Expand Down Expand Up @@ -291,12 +358,11 @@ Accept wildcard characters: False
```
### -UserAssignedIdentity
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.
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.Collections.Hashtable
Type: System.String[]
Parameter Sets: CreateExpanded, CreateViaIdentityExpanded
Aliases:

Expand Down
Loading

0 comments on commit 0b1f7d9

Please sign in to comment.