Skip to content

Commit eb18fae

Browse files
authored
Update managed-identity-best-practices.md (#25895)
* Update managed-identity-best-practices.md * Update managed-identity-best-practices.md * Update managed-identity-best-practices.md
1 parent 5a71bc9 commit eb18fae

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

documentation/development-docs/design-guidelines/managed-identity-best-practices.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,32 @@ We are recommended to use string array as the type of UserAssignedIdentity with
5858
- No syntax changes if service supports one more user assigned identity in future;
5959
- Service will provide correct error response if customer reaches the count limitation of `UserAssignedIdentity` ideally, which means no harm.
6060

61+
### How to disable transforming IdentityType and UserAssignedIdentity to avoid breaking changes when migrate from autorest.powershell v3 to v4.
62+
See details at [here](https://github.com/Azure/autorest.powershell/blob/main/docs/migration-from-v3-to-v4.md#how-to-mitigate-the-breaking-changes-of-managed-identity-best-practice-alignment).
63+
64+
### What should I do to mitigate one patch operation which is reported to parameter IdentityType can not be transformed as the best practice design?
65+
66+
autorest.powershell is unable to transform IdentityType as the best practice design for certain reasons. To mitigate this issue,
67+
- Include a customization script to transform the parameter IdentityType to EnableSystemAssignedIdentity by `get` + `patch` update for this type of operation. The following are the detailed steps on how to accomplish this.
68+
- disable transformation for the operation which reported error in README.md by
69+
```
70+
disable-transform-identity-type-for-operation
71+
- Operation_id
72+
```
73+
- hide the corresponding Update cmdlet in directive by
74+
```
75+
- where:
76+
verb: Update
77+
subject: {Subject-Name}
78+
hide: true
79+
```
80+
- run `autorest` and `./build-module.ps1`
81+
- manually change IdentityType to EnableSystemAssignedIdentity<bool> in `Update-Az{ModuleName}{Subject-Name}` like
82+
```
83+
[Parameter()]
84+
[Microsoft.Azure.PowerShell.Cmdlets.{ModuleName}.Category('Body')]
85+
[System.Nullable[System.Boolean]]
86+
# Decides if enable a system assigned identity for the resource.
87+
${EnableSystemAssignedIdentity},
88+
```
89+
- calculate the value of IdentityType as swagger defined in process block, see [instance](https://github.com/Azure/azure-powershell/blob/827001c79c4416e0b74f5857c2ad72b7932b1f9a/src/Astro/Astro.Autorest/custom/Update-AzAstroOrganization.ps1#L269) for Update-Az{ModuleName}{Subject-Name}.

0 commit comments

Comments
 (0)