From 57616c68aa9ee87aed5eef3b6be7f4481ee26371 Mon Sep 17 00:00:00 2001 From: azure-powershell-bot <65331932+azure-powershell-bot@users.noreply.github.com> Date: Mon, 6 Nov 2023 12:23:46 +0000 Subject: [PATCH 1/2] Move Subscription to main --- .../Az.Subscription.format.ps1xml | 40 +- src/Subscription/Az.Subscription.psd1 | 9 +- src/Subscription/README.md | 46 +- src/Subscription/Subscription.sln | 70 +- .../Microsoft.Subscription/subscriptions.json | 37 - src/Subscription/build-module.ps1 | 9 +- ...et-AzSubscriptionAcceptOwnershipStatus.ps1 | 120 ++++ .../custom/New-AzSubscriptionAlias.ps1 | 170 +++++ .../custom/Rename-AzSubscription.ps1 | 125 ++++ ...Get-AzSubscriptionAcceptOwnershipStatus.md | 6 +- .../examples/Get-AzSubscriptionAlias.md | 14 +- .../Invoke-AzSubscriptionAcceptOwnership.md | 2 +- .../examples/New-AzSubscriptionAlias.md | 14 +- .../examples/Update-AzSubscriptionPolicy.md | 12 - .../exports/Disable-AzSubscription.ps1 | 5 + .../exports/Enable-AzSubscription.ps1 | 5 + ...et-AzSubscriptionAcceptOwnershipStatus.ps1 | 11 +- .../exports/Get-AzSubscriptionAlias.ps1 | 5 + .../exports/Get-AzSubscriptionPolicy.ps1 | 4 + .../Invoke-AzSubscriptionAcceptOwnership.ps1 | 16 +- .../exports/New-AzSubscriptionAlias.ps1 | 64 +- .../exports/ProxyCmdletDefinitions.ps1 | 536 ++++++--------- .../exports/Remove-AzSubscriptionAlias.ps1 | 5 + .../exports/Rename-AzSubscription.ps1 | 12 +- src/Subscription/generate-help.ps1 | 4 +- src/Subscription/generate-info.json | 4 +- src/Subscription/generate-portal-ux.ps1 | 375 +++++++++++ .../AcceptOwnershipStatusResponse.cs | 7 + .../Api20211001/SubscriptionAliasResponse.cs | 6 +- .../SubscriptionCreationResult.PowerShell.cs | 166 +++++ ...ubscriptionCreationResult.TypeConverter.cs | 147 ++++ .../Api20211001/SubscriptionCreationResult.cs | 57 ++ .../SubscriptionCreationResult.json.cs | 108 +++ .../Models/SubscriptionIdentity.PowerShell.cs | 8 + .../api/Models/SubscriptionIdentity.cs | 23 + .../api/Models/SubscriptionIdentity.json.cs | 2 + .../generated/api/Subscription.cs | 161 +++++ .../cmdlets/DisableAzSubscription_Cancel.cs | 1 + ...DisableAzSubscription_CancelViaIdentity.cs | 1 + .../cmdlets/EnableAzSubscription_Enable.cs | 1 + .../EnableAzSubscription_EnableViaIdentity.cs | 1 + ...ionAcceptOwnershipStatus_AcceptExpanded.cs | 2 + ...nershipStatus_AcceptViaIdentityExpanded.cs | 2 + .../cmdlets/GetAzSubscriptionAlias_Get.cs | 1 + .../GetAzSubscriptionAlias_GetViaIdentity.cs | 1 + .../cmdlets/GetAzSubscriptionAlias_List.cs | 1 + .../cmdlets/GetAzSubscriptionOperation_Get.cs | 414 ++++++++++++ ...tAzSubscriptionOperation_GetViaIdentity.cs | 418 ++++++++++++ .../GetAzSubscriptionOperation_List.cs | 1 + .../cmdlets/GetAzSubscriptionPolicy_List.cs | 1 + ...scriptionAcceptOwnership_AcceptExpanded.cs | 24 +- ...ceptOwnership_AcceptViaIdentityExpanded.cs | 24 +- .../NewAzSubscriptionAlias_CreateExpanded.cs | 25 +- .../RemoveAzSubscriptionAlias_Delete.cs | 1 + ...veAzSubscriptionAlias_DeleteViaIdentity.cs | 1 + .../RenameAzSubscription_RenameExpanded.cs | 2 + ...zSubscription_RenameViaIdentityExpanded.cs | 2 + .../UpdateAzSubscriptionPolicy_AddExpanded.cs | 2 + .../BuildTime/Cmdlets/ExportHelpMarkdown.cs | 5 +- .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 5 +- .../runtime/BuildTime/MarkdownRenderer.cs | 24 +- .../BuildTime/Models/PsProxyOutputs.cs | 9 +- .../runtime/BuildTime/PsAttributes.cs | 7 + .../generated/runtime/MessageAttribute.cs | 25 +- .../runtime/MessageAttributeHelper.cs | 33 +- .../runtime/Properties/Resources.Designer.cs | 11 +- .../runtime/Properties/Resources.resx | 5 +- src/Subscription/help/Az.Subscription.md | 3 - .../help/Disable-AzSubscription.md | 13 - .../help/Enable-AzSubscription.md | 13 - ...Get-AzSubscriptionAcceptOwnershipStatus.md | 23 +- .../help/Get-AzSubscriptionAlias.md | 27 +- .../help/Get-AzSubscriptionPolicy.md | 2 - .../Invoke-AzSubscriptionAcceptOwnership.md | 53 +- .../help/New-AzSubscriptionAlias.md | 79 ++- .../help/Remove-AzSubscriptionAlias.md | 13 - .../help/Rename-AzSubscription.md | 21 +- .../help/Update-AzSubscriptionPolicy.md | 146 ---- ...et-AzSubscriptionAcceptOwnershipStatus.ps1 | 150 +++++ .../internal/Get-AzSubscriptionOperation.ps1 | 43 +- .../internal/New-AzSubscriptionAlias.ps1 | 202 ++++++ .../internal/ProxyCmdletDefinitions.ps1 | 636 +++++++++++++++++- .../internal/Rename-AzSubscription.ps1 | 157 +++++ .../Update-AzSubscriptionPolicy.ps1 | 44 +- .../test/AzSubscription.Tests.ps1 | 2 +- .../test/Get-AzSubscriptionPolicy.Tests.ps1 | 2 +- .../test/New-AzSubscriptionAlias.Tests.ps1 | 4 + .../Update-AzSubscriptionPolicy.Tests.ps1 | 21 - 88 files changed, 4178 insertions(+), 931 deletions(-) delete mode 100644 src/Subscription/UX/Microsoft.Subscription/subscriptions.json create mode 100644 src/Subscription/custom/Get-AzSubscriptionAcceptOwnershipStatus.ps1 create mode 100644 src/Subscription/custom/New-AzSubscriptionAlias.ps1 create mode 100644 src/Subscription/custom/Rename-AzSubscription.ps1 delete mode 100644 src/Subscription/examples/Update-AzSubscriptionPolicy.md create mode 100644 src/Subscription/generate-portal-ux.ps1 create mode 100644 src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.PowerShell.cs create mode 100644 src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.TypeConverter.cs create mode 100644 src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.cs create mode 100644 src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.json.cs create mode 100644 src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_Get.cs create mode 100644 src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_GetViaIdentity.cs delete mode 100644 src/Subscription/help/Update-AzSubscriptionPolicy.md create mode 100644 src/Subscription/internal/Get-AzSubscriptionAcceptOwnershipStatus.ps1 create mode 100644 src/Subscription/internal/New-AzSubscriptionAlias.ps1 create mode 100644 src/Subscription/internal/Rename-AzSubscription.ps1 rename src/Subscription/{exports => internal}/Update-AzSubscriptionPolicy.ps1 (64%) delete mode 100644 src/Subscription/test/Update-AzSubscriptionPolicy.Tests.ps1 diff --git a/src/Subscription/Az.Subscription.format.ps1xml b/src/Subscription/Az.Subscription.format.ps1xml index b563c20c48e7..c6fde10a41b3 100644 --- a/src/Subscription/Az.Subscription.format.ps1xml +++ b/src/Subscription/Az.Subscription.format.ps1xml @@ -14,6 +14,9 @@ + + + @@ -27,6 +30,9 @@ BillingAccountId + + OperationId + SubscriptionId @@ -150,9 +156,6 @@ - - - @@ -172,9 +175,6 @@ BillingOwner - - DisplayName - ProvisioningState @@ -725,9 +725,6 @@ - - - @@ -741,9 +738,6 @@ AliasName - - DisplayName - SubscriptionId @@ -859,6 +853,28 @@ + + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.SubscriptionCreationResult + + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.SubscriptionCreationResult + + + + + + + + + + + + SubscriptionLink + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.SubscriptionName diff --git a/src/Subscription/Az.Subscription.psd1 b/src/Subscription/Az.Subscription.psd1 index 64e39467675d..1014c141f1c7 100644 --- a/src/Subscription/Az.Subscription.psd1 +++ b/src/Subscription/Az.Subscription.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 8/30/2023 +# Generated on: 11/6/2023 # @{ @@ -73,8 +73,7 @@ FunctionsToExport = 'Disable-AzSubscription', 'Enable-AzSubscription', 'Get-AzSubscriptionAcceptOwnershipStatus', 'Get-AzSubscriptionAlias', 'Get-AzSubscriptionPolicy', 'Invoke-AzSubscriptionAcceptOwnership', 'New-AzSubscriptionAlias', - 'Remove-AzSubscriptionAlias', 'Rename-AzSubscription', - 'Update-AzSubscriptionPolicy' + 'Remove-AzSubscriptionAlias', 'Rename-AzSubscription' # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() @@ -112,9 +111,7 @@ PrivateData = @{ # IconUri = '' # ReleaseNotes of this module - ReleaseNotes = '* Removed the default value for the ''New-AzSubscriptionAlias'' cmdlet parameter ''SubscriptionId''. -* Removed the default value for the ''Get-AzSubscriptionAcceptOwnershipStatus'' cmdlet parameter ''SubscriptionId'' and mark the parameter as mandatory. -* Removed the default value for the ''Invoke-AzSubscriptionAcceptOwnership'' cmdlet parameter ''SubscriptionId'' and mark the parameter as mandatory.' + # ReleaseNotes = '' # Prerelease string of this module # Prerelease = '' diff --git a/src/Subscription/README.md b/src/Subscription/README.md index 7844631650eb..954597d5e01d 100644 --- a/src/Subscription/README.md +++ b/src/Subscription/README.md @@ -35,7 +35,7 @@ In this directory, run AutoRest: > see https://aka.ms/autorest ``` yaml -branch: be90a71f6a482c5b01155b3c9990887529cc6893 +branch: 0f39a2d56070d2bc4251494525cb8af88583a938 require: - $(this-folder)/../readme.azure.noprofile.md input-file: @@ -126,6 +126,16 @@ directive: variant: ^Get$ remove: true + # operation cmdlet must be removed + - where: + subject: SubscriptionOperation + hide: true + # Service feedback: As only global admins to run this, we don't want to have cmdlets for these as 1st class experience + - where: + verb: Update + subject: SubscriptionPolicy + hide: true + - where: subject: AcceptSubscriptionOwnership set: @@ -161,6 +171,12 @@ directive: parameter-name: AdditionalPropertyTag set: parameter-name: Tag + # All cmdlets parameter SubscriptionName has the alias DisplayName. ReName-AzSubscription needs to be customized to add an alias. + - where: + parameter-name: DisplayName + set: + parameter-name: SubscriptionName + alias: DisplayName - where: subject: Alias parameter-name: Name @@ -173,6 +189,17 @@ directive: set: property-name: AliasName + # Need to divided the command into two different ones based on the mutual exclusion parameter: + - where: + verb: New + subject: Alias + hide: true + # SubscriptionName must be required + - where: + verb: Rename + subject: Subscription + hide: true + - from: NewAzSubscriptionAlias_CreateExpanded.cs where: $ transform: $ = $.replace('[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.DefaultInfo(', ''); @@ -222,13 +249,18 @@ directive: parameter-name: SubscriptionId required: true + # Updated Parameter type of SubscriptionId from string[] to string. + - where: + verb: Get + subject: AcceptOwnershipStatus + hide: true + - where: model-name: SubscriptionAliasResponse set: format-table: properties: - AliasName - - DisplayName - SubscriptionId - ProvisioningState - where: @@ -240,4 +272,14 @@ directive: - PolicyId - BlockSubscriptionsIntoTenant - BlockSubscriptionsLeavingTenant + - where: + model-name: AcceptOwnershipStatusResponse + set: + format-table: + properties: + - AcceptOwnershipState + - BillingOwner + - ProvisioningState + - SubscriptionId + - SubscriptionTenantId ``` diff --git a/src/Subscription/Subscription.sln b/src/Subscription/Subscription.sln index 7d0b4e887de3..ea9ce8ccf740 100644 --- a/src/Subscription/Subscription.sln +++ b/src/Subscription/Subscription.sln @@ -3,19 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{1A685DC2-78F4-4A5D-98A5-104EBD3C625B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{3E5029BA-AB3D-473B-A73D-14AF26951107}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{7AF958BA-1FF6-4A67-BB43-3D5ED571EA2D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{4E479E72-AE5C-4657-8A85-5D7EB740D9EE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{841DD6FE-FDF2-4BCD-A4E2-3A49DA3BD5B2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{2852F1E5-9C0E-4238-BF57-135B3A24E69D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{FB507F39-A55D-47E6-A64C-9056E197C461}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{23E6E6DB-A9EA-4007-9521-EC37A0C866B0}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{F91CF8C2-7A32-4D90-B272-4AAE87CE2922}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{035C5B60-9416-4808-9365-5BDBE37EEBBD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{2FFA59A3-0F53-4CAC-835B-9BC446ED0BA0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Subscription", "Az.Subscription.csproj", "{980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Subscription", "Az.Subscription.csproj", "{91971054-DE33-489F-9EC2-C959526352EC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -26,33 +26,33 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}.Release|Any CPU.Build.0 = Release|Any CPU - {3E5029BA-AB3D-473B-A73D-14AF26951107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3E5029BA-AB3D-473B-A73D-14AF26951107}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3E5029BA-AB3D-473B-A73D-14AF26951107}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3E5029BA-AB3D-473B-A73D-14AF26951107}.Release|Any CPU.Build.0 = Release|Any CPU - {4E479E72-AE5C-4657-8A85-5D7EB740D9EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4E479E72-AE5C-4657-8A85-5D7EB740D9EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4E479E72-AE5C-4657-8A85-5D7EB740D9EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4E479E72-AE5C-4657-8A85-5D7EB740D9EE}.Release|Any CPU.Build.0 = Release|Any CPU - {2852F1E5-9C0E-4238-BF57-135B3A24E69D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2852F1E5-9C0E-4238-BF57-135B3A24E69D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2852F1E5-9C0E-4238-BF57-135B3A24E69D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2852F1E5-9C0E-4238-BF57-135B3A24E69D}.Release|Any CPU.Build.0 = Release|Any CPU - {23E6E6DB-A9EA-4007-9521-EC37A0C866B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {23E6E6DB-A9EA-4007-9521-EC37A0C866B0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23E6E6DB-A9EA-4007-9521-EC37A0C866B0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {23E6E6DB-A9EA-4007-9521-EC37A0C866B0}.Release|Any CPU.Build.0 = Release|Any CPU - {035C5B60-9416-4808-9365-5BDBE37EEBBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {035C5B60-9416-4808-9365-5BDBE37EEBBD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {035C5B60-9416-4808-9365-5BDBE37EEBBD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {035C5B60-9416-4808-9365-5BDBE37EEBBD}.Release|Any CPU.Build.0 = Release|Any CPU - {980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}.Release|Any CPU.Build.0 = Release|Any CPU + {1A685DC2-78F4-4A5D-98A5-104EBD3C625B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1A685DC2-78F4-4A5D-98A5-104EBD3C625B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1A685DC2-78F4-4A5D-98A5-104EBD3C625B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1A685DC2-78F4-4A5D-98A5-104EBD3C625B}.Release|Any CPU.Build.0 = Release|Any CPU + {7AF958BA-1FF6-4A67-BB43-3D5ED571EA2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7AF958BA-1FF6-4A67-BB43-3D5ED571EA2D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7AF958BA-1FF6-4A67-BB43-3D5ED571EA2D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7AF958BA-1FF6-4A67-BB43-3D5ED571EA2D}.Release|Any CPU.Build.0 = Release|Any CPU + {841DD6FE-FDF2-4BCD-A4E2-3A49DA3BD5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {841DD6FE-FDF2-4BCD-A4E2-3A49DA3BD5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {841DD6FE-FDF2-4BCD-A4E2-3A49DA3BD5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {841DD6FE-FDF2-4BCD-A4E2-3A49DA3BD5B2}.Release|Any CPU.Build.0 = Release|Any CPU + {FB507F39-A55D-47E6-A64C-9056E197C461}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB507F39-A55D-47E6-A64C-9056E197C461}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB507F39-A55D-47E6-A64C-9056E197C461}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB507F39-A55D-47E6-A64C-9056E197C461}.Release|Any CPU.Build.0 = Release|Any CPU + {F91CF8C2-7A32-4D90-B272-4AAE87CE2922}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F91CF8C2-7A32-4D90-B272-4AAE87CE2922}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F91CF8C2-7A32-4D90-B272-4AAE87CE2922}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F91CF8C2-7A32-4D90-B272-4AAE87CE2922}.Release|Any CPU.Build.0 = Release|Any CPU + {2FFA59A3-0F53-4CAC-835B-9BC446ED0BA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2FFA59A3-0F53-4CAC-835B-9BC446ED0BA0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2FFA59A3-0F53-4CAC-835B-9BC446ED0BA0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2FFA59A3-0F53-4CAC-835B-9BC446ED0BA0}.Release|Any CPU.Build.0 = Release|Any CPU + {91971054-DE33-489F-9EC2-C959526352EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91971054-DE33-489F-9EC2-C959526352EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91971054-DE33-489F-9EC2-C959526352EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91971054-DE33-489F-9EC2-C959526352EC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/Subscription/UX/Microsoft.Subscription/subscriptions.json b/src/Subscription/UX/Microsoft.Subscription/subscriptions.json deleted file mode 100644 index 0947bb75c988..000000000000 --- a/src/Subscription/UX/Microsoft.Subscription/subscriptions.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "resourceType": "subscriptions", - "apiVersion": "2021-10-01", - "learnMore": { - "url": "https://learn.microsoft.com/powershell/module/az.subscription" - }, - "commands": [ - { - "name": "Get-AzSubscriptionAcceptOwnershipStatus", - "description": "Accept subscription ownership status.", - "path": "/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus", - "help": { - "learnMore": { - "url": "https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionacceptownershipstatus" - }, - "parameterSets": [ - { - "parameters": [ - "[-SubscriptionId ]" - ] - } - ] - }, - "examples": [ - { - "description": "Accept subscription ownership status.", - "parameters": [ - { - "name": "-SubscriptionId", - "value": "[Path.subscriptionId]" - } - ] - } - ] - } - ] -} diff --git a/src/Subscription/build-module.ps1 b/src/Subscription/build-module.ps1 index d1b2b50be24d..4481d1be7521 100644 --- a/src/Subscription/build-module.ps1 +++ b/src/Subscription/build-module.ps1 @@ -143,7 +143,8 @@ if($NoDocs) { $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue } $null = New-Item -ItemType Directory -Force -Path $docsFolder - Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo } Write-Host -ForegroundColor Green 'Creating format.ps1xml...' @@ -162,4 +163,10 @@ Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFol Write-Host -ForegroundColor Green 'Creating example stubs...' Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder +if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')) +{ + Write-Host -ForegroundColor Green 'Creating ux metadata...' + . (Join-Path $PSScriptRoot 'generate-portal-ux.ps1') +} + Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/src/Subscription/custom/Get-AzSubscriptionAcceptOwnershipStatus.ps1 b/src/Subscription/custom/Get-AzSubscriptionAcceptOwnershipStatus.ps1 new file mode 100644 index 000000000000..d818c49a3b11 --- /dev/null +++ b/src/Subscription/custom/Get-AzSubscriptionAcceptOwnershipStatus.ps1 @@ -0,0 +1,120 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Accept subscription ownership status. +.Description +Accept subscription ownership status. +.Example +Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +.Example +$subIdArray = @("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY") +Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId $subIdArray + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. +.Link +https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionacceptownershipstatus +#> +function Get-AzSubscriptionAcceptOwnershipStatus { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse])] + [CmdletBinding(DefaultParameterSetName = 'AcceptExpanded', PositionalBinding = $false)] + param( + [Parameter(ParameterSetName = 'AcceptExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # Subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName = 'AcceptViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + try { + Az.Subscription.internal\Get-AzSubscriptionAcceptOwnershipStatus @PSBoundParameters + } + catch { + throw + } + } +} diff --git a/src/Subscription/custom/New-AzSubscriptionAlias.ps1 b/src/Subscription/custom/New-AzSubscriptionAlias.ps1 new file mode 100644 index 000000000000..31090ade9f41 --- /dev/null +++ b/src/Subscription/custom/New-AzSubscriptionAlias.ps1 @@ -0,0 +1,170 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create Alias Subscription. +.Description +Create Alias Subscription. +.Example +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +.Example +New-AzSubscriptionAlias -AliasName test-subscription -DisplayName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse +.Link +https://learn.microsoft.com/powershell/module/az.subscription/new-azsubscriptionalias +#> +function New-AzSubscriptionAlias { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse])] + [CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # AliasName is the name for the subscription creation request. + # Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + ${AliasName}, + + [Parameter(ParameterSetName = 'WorkloadCreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Billing scope of the subscription.For CustomerLed and FieldLed - /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName}For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName} + ${BillingScope}, + + [Parameter(ParameterSetName = 'WorkloadCreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Management group Id for the subscription. + ${ManagementGroupId}, + + [Parameter(ParameterSetName = 'WorkloadCreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Reseller Id + ${ResellerId}, + + [Parameter(ParameterSetName = 'CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # This parameter can be used to create alias for existing subscription Id + ${SubscriptionId}, + + [Parameter(ParameterSetName = 'WorkloadCreateExpanded', Mandatory)] + [Alias('DisplayName')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # The friendly name of the subscription. + ${SubscriptionName}, + + [Parameter(ParameterSetName = 'WorkloadCreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Owner Id of the subscription + ${SubscriptionOwnerId}, + + [Parameter(ParameterSetName = 'WorkloadCreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Tenant Id of the subscription + ${SubscriptionTenantId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IPutAliasRequestAdditionalPropertiesTags]))] + [System.Collections.Hashtable] + # Tags for the subscription + ${Tag}, + + [Parameter(ParameterSetName = 'WorkloadCreateExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload])] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload] + # The workload type of the subscription. + # It can be either Production or DevTest. + ${Workload}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + try { + Az.Subscription.internal\New-AzSubscriptionAlias @PSBoundParameters + } + catch { + throw + } + } +} diff --git a/src/Subscription/custom/Rename-AzSubscription.ps1 b/src/Subscription/custom/Rename-AzSubscription.ps1 new file mode 100644 index 000000000000..49784d63717a --- /dev/null +++ b/src/Subscription/custom/Rename-AzSubscription.ps1 @@ -0,0 +1,125 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to rename a subscription +.Description +The operation to rename a subscription +.Example +Rename-AzSubscription -Id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -SubscriptionName test-subscription + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity +.Outputs +System.String +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. +.Link +https://learn.microsoft.com/powershell/module/az.subscription/rename-azsubscription +#> +function Rename-AzSubscription { + [OutputType([System.String])] + [CmdletBinding(DefaultParameterSetName = 'RenameExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'RenameExpanded', Mandatory)] + [Alias('SubscriptionId')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # Subscription Id. + ${Id}, + + [Parameter(ParameterSetName = 'RenameViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(Mandatory)] + [Alias('DisplayName')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # New subscription name + ${SubscriptionName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + try { + Az.Subscription.internal\Rename-AzSubscription @PSBoundParameters + } + catch { + throw + } + } +} diff --git a/src/Subscription/examples/Get-AzSubscriptionAcceptOwnershipStatus.md b/src/Subscription/examples/Get-AzSubscriptionAcceptOwnershipStatus.md index ba2c9d49ee4f..39d4b59b96fe 100644 --- a/src/Subscription/examples/Get-AzSubscriptionAcceptOwnershipStatus.md +++ b/src/Subscription/examples/Get-AzSubscriptionAcceptOwnershipStatus.md @@ -4,9 +4,9 @@ Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX- ``` ```output -AcceptOwnershipState BillingOwner DisplayName ProvisioningState SubscriptionId SubscriptionTenantId --------------------- ------------ ----------- ----------------- -------------- -------------------- -Completed xxxxxxxx@xxxx.com create18 Pending XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +AcceptOwnershipState BillingOwner ProvisioningState SubscriptionId SubscriptionTenantId +-------------------- ------------ ----------------- -------------- -------------------- +Completed xxxxxxxx@xxxx.com Pending XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX ``` Accept subscription ownership status. \ No newline at end of file diff --git a/src/Subscription/examples/Get-AzSubscriptionAlias.md b/src/Subscription/examples/Get-AzSubscriptionAlias.md index bf4937e9a481..bdc0a58ad681 100644 --- a/src/Subscription/examples/Get-AzSubscriptionAlias.md +++ b/src/Subscription/examples/Get-AzSubscriptionAlias.md @@ -4,10 +4,10 @@ Get-AzSubscriptionAlias ``` ```output -AliasName DisplayName SubscriptionId ProvisioningState ---------- ----------- -------------- ----------------- -test-subscription createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded -test-subscription2 createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +AliasName SubscriptionId ProvisioningState +--------- -------------- ----------------- +test-subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +test-subscription2 XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded ``` List Alias Subscription. @@ -18,9 +18,9 @@ Get-AzSubscriptionAlias -AliasName test-subscription ``` ```output -AliasName DisplayName SubscriptionId ProvisioningState ---------- ----------- -------------- ----------------- -test-subscription createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +AliasName SubscriptionId ProvisioningState +--------- -------------- ----------------- +test-subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded ``` Get Alias Subscription. \ No newline at end of file diff --git a/src/Subscription/examples/Invoke-AzSubscriptionAcceptOwnership.md b/src/Subscription/examples/Invoke-AzSubscriptionAcceptOwnership.md index 45b86157b3dd..42ccbae9c8ce 100644 --- a/src/Subscription/examples/Invoke-AzSubscriptionAcceptOwnership.md +++ b/src/Subscription/examples/Invoke-AzSubscriptionAcceptOwnership.md @@ -1,6 +1,6 @@ ### Example 1: Accept subscription ownership. ```powershell -Invoke-AzSubscriptionAcceptOwnership -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -DisplayName "createSub" -Tag @{"abc"="123"} -PassThru +Invoke-AzSubscriptionAcceptOwnership -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -SubscriptionName "createSub" -Tag @{"abc"="123"} -PassThru ``` ```output diff --git a/src/Subscription/examples/New-AzSubscriptionAlias.md b/src/Subscription/examples/New-AzSubscriptionAlias.md index 1904e0feaacb..d2d8adf985ca 100644 --- a/src/Subscription/examples/New-AzSubscriptionAlias.md +++ b/src/Subscription/examples/New-AzSubscriptionAlias.md @@ -4,22 +4,22 @@ New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XX ``` ```output -AliasName DisplayName SubscriptionId ProvisioningState ---------- ----------- -------------- ----------------- -test-subscription createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +AliasName SubscriptionId ProvisioningState +--------- -------------- ----------------- +test-subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded ``` Create Alias Subscription. ### Example 2: Create Alias Subscription. ```powershell -New-AzSubscriptionAlias -AliasName test-subscription -DisplayName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' ``` ```output -AliasName DisplayName SubscriptionId ProvisioningState ---------- ----------- -------------- ----------------- -test-subscription createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +AliasName SubscriptionId ProvisioningState +--------- -------------- ----------------- +test-subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded ``` Create Alias Subscription. \ No newline at end of file diff --git a/src/Subscription/examples/Update-AzSubscriptionPolicy.md b/src/Subscription/examples/Update-AzSubscriptionPolicy.md deleted file mode 100644 index 799370c3eb22..000000000000 --- a/src/Subscription/examples/Update-AzSubscriptionPolicy.md +++ /dev/null @@ -1,12 +0,0 @@ -### Example 1: Create or Update Subscription tenant policy for user's tenant. -```powershell -Update-AzSubscriptionPolicy -BlockSubscriptionsIntoTenant:$true -BlockSubscriptionsLeavingTenant:$false -ExemptedPrincipal XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -``` - -```output -Name PolicyId BlockSubscriptionsIntoTenant BlockSubscriptionsLeavingTenant ----- -------- ---------------------------- ------------------------------- -default XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX True False -``` - -Create or Update Subscription tenant policy for user's tenant. \ No newline at end of file diff --git a/src/Subscription/exports/Disable-AzSubscription.ps1 b/src/Subscription/exports/Disable-AzSubscription.ps1 index a689acabbbfa..e85aa529136d 100644 --- a/src/Subscription/exports/Disable-AzSubscription.ps1 +++ b/src/Subscription/exports/Disable-AzSubscription.ps1 @@ -35,6 +35,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/disable-azsubscription @@ -137,6 +138,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/exports/Enable-AzSubscription.ps1 b/src/Subscription/exports/Enable-AzSubscription.ps1 index bc8335cdbc21..60485d21a374 100644 --- a/src/Subscription/exports/Enable-AzSubscription.ps1 +++ b/src/Subscription/exports/Enable-AzSubscription.ps1 @@ -35,6 +35,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/enable-azsubscription @@ -137,6 +138,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/exports/Get-AzSubscriptionAcceptOwnershipStatus.ps1 b/src/Subscription/exports/Get-AzSubscriptionAcceptOwnershipStatus.ps1 index 5207dccf4409..4c86027726e5 100644 --- a/src/Subscription/exports/Get-AzSubscriptionAcceptOwnershipStatus.ps1 +++ b/src/Subscription/exports/Get-AzSubscriptionAcceptOwnershipStatus.ps1 @@ -35,6 +35,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionacceptownershipstatus @@ -45,7 +46,7 @@ function Get-AzSubscriptionAcceptOwnershipStatus { param( [Parameter(ParameterSetName='AcceptExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] - [System.String[]] + [System.String] # Subscription Id. ${SubscriptionId}, @@ -131,11 +132,15 @@ begin { } $mapping = @{ - AcceptExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptExpanded'; - AcceptViaIdentityExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded'; + AcceptExpanded = 'Az.Subscription.custom\Get-AzSubscriptionAcceptOwnershipStatus'; + AcceptViaIdentityExpanded = 'Az.Subscription.custom\Get-AzSubscriptionAcceptOwnershipStatus'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/exports/Get-AzSubscriptionAlias.ps1 b/src/Subscription/exports/Get-AzSubscriptionAlias.ps1 index 331b2464bd92..eb946ddcf0af 100644 --- a/src/Subscription/exports/Get-AzSubscriptionAlias.ps1 +++ b/src/Subscription/exports/Get-AzSubscriptionAlias.ps1 @@ -39,6 +39,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionalias @@ -142,6 +143,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/exports/Get-AzSubscriptionPolicy.ps1 b/src/Subscription/exports/Get-AzSubscriptionPolicy.ps1 index 26b73854aea8..da9f4ba2d773 100644 --- a/src/Subscription/exports/Get-AzSubscriptionPolicy.ps1 +++ b/src/Subscription/exports/Get-AzSubscriptionPolicy.ps1 @@ -110,6 +110,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/exports/Invoke-AzSubscriptionAcceptOwnership.ps1 b/src/Subscription/exports/Invoke-AzSubscriptionAcceptOwnership.ps1 index c8e37f43ba02..58426cabd4af 100644 --- a/src/Subscription/exports/Invoke-AzSubscriptionAcceptOwnership.ps1 +++ b/src/Subscription/exports/Invoke-AzSubscriptionAcceptOwnership.ps1 @@ -20,7 +20,7 @@ Accept subscription ownership. .Description Accept subscription ownership. .Example -Invoke-AzSubscriptionAcceptOwnership -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -DisplayName "createSub" -Tag @{"abc"="123"} -PassThru +Invoke-AzSubscriptionAcceptOwnership -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -SubscriptionName "createSub" -Tag @{"abc"="123"} -PassThru .Inputs Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity @@ -35,6 +35,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/invoke-azsubscriptionacceptownership @@ -59,14 +60,15 @@ param( [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] - # The friendly name of the subscription. - ${DisplayName}, + # Management group Id for the subscription. + ${ManagementGroupId}, [Parameter()] + [Alias('DisplayName')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] - # Management group Id for the subscription. - ${ManagementGroupId}, + # The friendly name of the subscription. + ${SubscriptionName}, [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] @@ -173,6 +175,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/exports/New-AzSubscriptionAlias.ps1 b/src/Subscription/exports/New-AzSubscriptionAlias.ps1 index b6d89683ba88..a508af135cf1 100644 --- a/src/Subscription/exports/New-AzSubscriptionAlias.ps1 +++ b/src/Subscription/exports/New-AzSubscriptionAlias.ps1 @@ -22,7 +22,7 @@ Create Alias Subscription. .Example New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX .Example -New-AzSubscriptionAlias -AliasName test-subscription -DisplayName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' .Outputs Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse @@ -40,63 +40,64 @@ param( # Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. ${AliasName}, + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # This parameter can be used to create alias for existing subscription Id + ${SubscriptionId}, + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IPutAliasRequestAdditionalPropertiesTags]))] + [System.Collections.Hashtable] + # Tags for the subscription + ${Tag}, + + [Parameter(ParameterSetName='WorkloadCreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] # Billing scope of the subscription.For CustomerLed and FieldLed - /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName}For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName} ${BillingScope}, - [Parameter()] + [Parameter(ParameterSetName='WorkloadCreateExpanded', Mandatory)] + [Alias('DisplayName')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] # The friendly name of the subscription. - ${DisplayName}, + ${SubscriptionName}, - [Parameter()] + [Parameter(ParameterSetName='WorkloadCreateExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload])] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload] + # The workload type of the subscription. + # It can be either Production or DevTest. + ${Workload}, + + [Parameter(ParameterSetName='WorkloadCreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] # Management group Id for the subscription. ${ManagementGroupId}, - [Parameter()] + [Parameter(ParameterSetName='WorkloadCreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] # Reseller Id ${ResellerId}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.String] - # This parameter can be used to create alias for existing subscription Id - ${SubscriptionId}, - - [Parameter()] + [Parameter(ParameterSetName='WorkloadCreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] # Owner Id of the subscription ${SubscriptionOwnerId}, - [Parameter()] + [Parameter(ParameterSetName='WorkloadCreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] # Tenant Id of the subscription ${SubscriptionTenantId}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IPutAliasRequestAdditionalPropertiesTags]))] - [System.Collections.Hashtable] - # Tags for the subscription - ${Tag}, - - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload])] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload] - # The workload type of the subscription. - # It can be either Production or DevTest. - ${Workload}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -184,10 +185,15 @@ begin { } $mapping = @{ - CreateExpanded = 'Az.Subscription.private\New-AzSubscriptionAlias_CreateExpanded'; + CreateExpanded = 'Az.Subscription.custom\New-AzSubscriptionAlias'; + WorkloadCreateExpanded = 'Az.Subscription.custom\New-AzSubscriptionAlias'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/exports/ProxyCmdletDefinitions.ps1 b/src/Subscription/exports/ProxyCmdletDefinitions.ps1 index 79c43cf21047..f9cf6fe505a7 100644 --- a/src/Subscription/exports/ProxyCmdletDefinitions.ps1 +++ b/src/Subscription/exports/ProxyCmdletDefinitions.ps1 @@ -35,6 +35,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/disable-azsubscription @@ -137,6 +138,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -202,6 +207,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/enable-azsubscription @@ -304,172 +310,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) - $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters} - $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) - $steppablePipeline.Begin($PSCmdlet) - } catch { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() - throw - } -} - -process { - try { - $steppablePipeline.Process($_) - } catch { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() - throw - } - - finally { - $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId - $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() - } - -} -end { - try { - $steppablePipeline.End() - - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets - if ($preTelemetryId -eq '') { - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId - - } catch { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() - throw - } -} -} - -<# -.Synopsis -Accept subscription ownership status. -.Description -Accept subscription ownership status. -.Example -Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity -.Outputs -Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse -.Notes -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - -INPUTOBJECT : Identity Parameter - [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - [BillingAccountId ]: Billing Account Id. - [Id ]: Resource identity path - [SubscriptionId ]: Subscription Id. -.Link -https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionacceptownershipstatus -#> -function Get-AzSubscriptionAcceptOwnershipStatus { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse])] -[CmdletBinding(DefaultParameterSetName='AcceptExpanded', PositionalBinding=$false)] -param( - [Parameter(ParameterSetName='AcceptExpanded', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] - [System.String[]] - # Subscription Id. - ${SubscriptionId}, - - [Parameter(ParameterSetName='AcceptViaIdentityExpanded', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] - # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - ${InputObject}, - - [Parameter()] - [Alias('AzureRMContext', 'AzureCredential')] - [ValidateNotNull()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] - [System.Management.Automation.PSObject] - # The DefaultProfile parameter is not functional. - # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. - ${DefaultProfile}, - - [Parameter(DontShow)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Wait for .NET debugger to attach - ${Break}, - - [Parameter(DontShow)] - [ValidateNotNull()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] - # SendAsync Pipeline Steps to be appended to the front of the pipeline - ${HttpPipelineAppend}, - - [Parameter(DontShow)] - [ValidateNotNull()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] - # SendAsync Pipeline Steps to be prepended to the front of the pipeline - ${HttpPipelinePrepend}, - - [Parameter(DontShow)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] - [System.Uri] - # The URI for the proxy server to use - ${Proxy}, - - [Parameter(DontShow)] - [ValidateNotNull()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] - [System.Management.Automation.PSCredential] - # Credentials for a proxy server to use for the remote call - ${ProxyCredential}, - - [Parameter(DontShow)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Use the default credentials for the proxy - ${ProxyUseDefaultCredentials} -) - -begin { - try { - $outBuffer = $null - if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { - $PSBoundParameters['OutBuffer'] = 1 - } - $parameterSet = $PSCmdlet.ParameterSetName - - if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { - [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() - } - $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId - if ($preTelemetryId -eq '') { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) - } else { - $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets - if ($internalCalledCmdlets -eq '') { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name - } else { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name - } - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' - } - - $mapping = @{ - AcceptExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptExpanded'; - AcceptViaIdentityExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded'; - } - $cmdInfo = Get-Command -Name $mapping[$parameterSet] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -539,6 +383,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionalias @@ -642,6 +487,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -782,6 +631,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -832,7 +685,7 @@ Accept subscription ownership. .Description Accept subscription ownership. .Example -Invoke-AzSubscriptionAcceptOwnership -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -DisplayName "createSub" -Tag @{"abc"="123"} -PassThru +Invoke-AzSubscriptionAcceptOwnership -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -SubscriptionName "createSub" -Tag @{"abc"="123"} -PassThru .Inputs Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity @@ -847,6 +700,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/invoke-azsubscriptionacceptownership @@ -871,14 +725,15 @@ param( [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] - # The friendly name of the subscription. - ${DisplayName}, + # Management group Id for the subscription. + ${ManagementGroupId}, [Parameter()] + [Alias('DisplayName')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] - # Management group Id for the subscription. - ${ManagementGroupId}, + # The friendly name of the subscription. + ${SubscriptionName}, [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] @@ -985,6 +840,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1031,86 +890,47 @@ end { <# .Synopsis -Create Alias Subscription. +Delete Alias. .Description -Create Alias Subscription. -.Example -New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +Delete Alias. .Example -New-AzSubscriptionAlias -AliasName test-subscription -DisplayName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' +Remove-AzSubscriptionAlias -AliasName test-subscription +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. .Link -https://learn.microsoft.com/powershell/module/az.subscription/new-azsubscriptionalias +https://learn.microsoft.com/powershell/module/az.subscription/remove-azsubscriptionalias #> -function New-AzSubscriptionAlias { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse])] -[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Remove-AzSubscriptionAlias { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Delete', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] [System.String] # AliasName is the name for the subscription creation request. # Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. ${AliasName}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.String] - # Billing scope of the subscription.For CustomerLed and FieldLed - /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName}For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName} - ${BillingScope}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.String] - # The friendly name of the subscription. - ${DisplayName}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.String] - # Management group Id for the subscription. - ${ManagementGroupId}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.String] - # Reseller Id - ${ResellerId}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.String] - # This parameter can be used to create alias for existing subscription Id - ${SubscriptionId}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.String] - # Owner Id of the subscription - ${SubscriptionOwnerId}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.String] - # Tenant Id of the subscription - ${SubscriptionTenantId}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IPutAliasRequestAdditionalPropertiesTags]))] - [System.Collections.Hashtable] - # Tags for the subscription - ${Tag}, - - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload])] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload] - # The workload type of the subscription. - # It can be either Production or DevTest. - ${Workload}, + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -1121,12 +941,6 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Run the command as a job - ${AsJob}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -1150,8 +964,8 @@ param( [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] [System.Management.Automation.SwitchParameter] - # Run the command asynchronously - ${NoWait}, + # Returns true when the command succeeds + ${PassThru}, [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] @@ -1199,10 +1013,15 @@ begin { } $mapping = @{ - CreateExpanded = 'Az.Subscription.private\New-AzSubscriptionAlias_CreateExpanded'; + Delete = 'Az.Subscription.private\Remove-AzSubscriptionAlias_Delete'; + DeleteViaIdentity = 'Az.Subscription.private\Remove-AzSubscriptionAlias_DeleteViaIdentity'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1249,16 +1068,16 @@ end { <# .Synopsis -Delete Alias. +Accept subscription ownership status. .Description -Delete Alias. +Accept subscription ownership status. .Example -Remove-AzSubscriptionAlias -AliasName test-subscription +Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX .Inputs Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity .Outputs -System.Boolean +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse .Notes COMPLEX PARAMETER PROPERTIES @@ -1268,22 +1087,22 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link -https://learn.microsoft.com/powershell/module/az.subscription/remove-azsubscriptionalias +https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionacceptownershipstatus #> -function Remove-AzSubscriptionAlias { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzSubscriptionAcceptOwnershipStatus { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse])] +[CmdletBinding(DefaultParameterSetName='AcceptExpanded', PositionalBinding=$false)] param( - [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='AcceptExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] [System.String] - # AliasName is the name for the subscription creation request. - # Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - ${AliasName}, + # Subscription Id. + ${SubscriptionId}, - [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='AcceptViaIdentityExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] # Identity Parameter @@ -1319,12 +1138,6 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] [System.Uri] @@ -1371,11 +1184,15 @@ begin { } $mapping = @{ - Delete = 'Az.Subscription.private\Remove-AzSubscriptionAlias_Delete'; - DeleteViaIdentity = 'Az.Subscription.private\Remove-AzSubscriptionAlias_DeleteViaIdentity'; + AcceptExpanded = 'Az.Subscription.custom\Get-AzSubscriptionAcceptOwnershipStatus'; + AcceptViaIdentityExpanded = 'Az.Subscription.custom\Get-AzSubscriptionAcceptOwnershipStatus'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1422,53 +1239,88 @@ end { <# .Synopsis -The operation to rename a subscription +Create Alias Subscription. .Description -The operation to rename a subscription +Create Alias Subscription. .Example -Rename-AzSubscription -Id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -SubscriptionName test-subscription +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +.Example +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity .Outputs -System.String -.Notes -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - -INPUTOBJECT : Identity Parameter - [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - [BillingAccountId ]: Billing Account Id. - [Id ]: Resource identity path - [SubscriptionId ]: Subscription Id. +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse .Link -https://learn.microsoft.com/powershell/module/az.subscription/rename-azsubscription +https://learn.microsoft.com/powershell/module/az.subscription/new-azsubscriptionalias #> -function Rename-AzSubscription { -[OutputType([System.String])] -[CmdletBinding(DefaultParameterSetName='RenameExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function New-AzSubscriptionAlias { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='RenameExpanded', Mandatory)] - [Alias('SubscriptionId')] + [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] [System.String] - # Subscription Id. - ${Id}, + # AliasName is the name for the subscription creation request. + # Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + ${AliasName}, - [Parameter(ParameterSetName='RenameViaIdentityExpanded', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] - # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - ${InputObject}, + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # This parameter can be used to create alias for existing subscription Id + ${SubscriptionId}, [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IPutAliasRequestAdditionalPropertiesTags]))] + [System.Collections.Hashtable] + # Tags for the subscription + ${Tag}, + + [Parameter(ParameterSetName='WorkloadCreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] - # New subscription name + # Billing scope of the subscription.For CustomerLed and FieldLed - /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName}For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName} + ${BillingScope}, + + [Parameter(ParameterSetName='WorkloadCreateExpanded', Mandatory)] + [Alias('DisplayName')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # The friendly name of the subscription. ${SubscriptionName}, + [Parameter(ParameterSetName='WorkloadCreateExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload])] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload] + # The workload type of the subscription. + # It can be either Production or DevTest. + ${Workload}, + + [Parameter(ParameterSetName='WorkloadCreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Management group Id for the subscription. + ${ManagementGroupId}, + + [Parameter(ParameterSetName='WorkloadCreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Reseller Id + ${ResellerId}, + + [Parameter(ParameterSetName='WorkloadCreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Owner Id of the subscription + ${SubscriptionOwnerId}, + + [Parameter(ParameterSetName='WorkloadCreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Tenant Id of the subscription + ${SubscriptionTenantId}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -1478,6 +1330,12 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -1498,6 +1356,12 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] [System.Uri] @@ -1544,11 +1408,15 @@ begin { } $mapping = @{ - RenameExpanded = 'Az.Subscription.private\Rename-AzSubscription_RenameExpanded'; - RenameViaIdentityExpanded = 'Az.Subscription.private\Rename-AzSubscription_RenameViaIdentityExpanded'; + CreateExpanded = 'Az.Subscription.custom\New-AzSubscriptionAlias'; + WorkloadCreateExpanded = 'Az.Subscription.custom\New-AzSubscriptionAlias'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1595,39 +1463,54 @@ end { <# .Synopsis -Create or Update Subscription tenant policy for user's tenant. +The operation to rename a subscription .Description -Create or Update Subscription tenant policy for user's tenant. +The operation to rename a subscription .Example -Update-AzSubscriptionPolicy -BlockSubscriptionsIntoTenant:$true -BlockSubscriptionsLeavingTenant:$false -ExemptedPrincipal XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +Rename-AzSubscription -Id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -SubscriptionName test-subscription +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse +System.String +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. .Link -https://learn.microsoft.com/powershell/module/az.subscription/update-azsubscriptionpolicy +https://learn.microsoft.com/powershell/module/az.subscription/rename-azsubscription #> -function Update-AzSubscriptionPolicy { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse])] -[CmdletBinding(DefaultParameterSetName='AddExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Rename-AzSubscription { +[OutputType([System.String])] +[CmdletBinding(DefaultParameterSetName='RenameExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Blocks the entering of subscriptions into user's tenant. - ${BlockSubscriptionsIntoTenant}, + [Parameter(ParameterSetName='RenameExpanded', Mandatory)] + [Alias('SubscriptionId')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # Subscription Id. + ${Id}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Blocks the leaving of subscriptions from user's tenant. - ${BlockSubscriptionsLeavingTenant}, + [Parameter(ParameterSetName='RenameViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, - [Parameter()] - [AllowEmptyCollection()] + [Parameter(Mandatory)] + [Alias('DisplayName')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] - [System.String[]] - # List of user objectIds that are exempted from the set subscription tenant policies for the user's tenant. - ${ExemptedPrincipal}, + [System.String] + # New subscription name + ${SubscriptionName}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -1704,10 +1587,15 @@ begin { } $mapping = @{ - AddExpanded = 'Az.Subscription.private\Update-AzSubscriptionPolicy_AddExpanded'; + RenameExpanded = 'Az.Subscription.custom\Rename-AzSubscription'; + RenameViaIdentityExpanded = 'Az.Subscription.custom\Rename-AzSubscription'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/exports/Remove-AzSubscriptionAlias.ps1 b/src/Subscription/exports/Remove-AzSubscriptionAlias.ps1 index 5ed17f6d13b2..217e55fce19e 100644 --- a/src/Subscription/exports/Remove-AzSubscriptionAlias.ps1 +++ b/src/Subscription/exports/Remove-AzSubscriptionAlias.ps1 @@ -35,6 +35,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/remove-azsubscriptionalias @@ -143,6 +144,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/exports/Rename-AzSubscription.ps1 b/src/Subscription/exports/Rename-AzSubscription.ps1 index 5cabe47dfb5a..5a0be484fa0b 100644 --- a/src/Subscription/exports/Rename-AzSubscription.ps1 +++ b/src/Subscription/exports/Rename-AzSubscription.ps1 @@ -35,6 +35,7 @@ INPUTOBJECT : Identity Parameter [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. [BillingAccountId ]: Billing Account Id. [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/rename-azsubscription @@ -57,7 +58,8 @@ param( # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter()] + [Parameter(Mandatory)] + [Alias('DisplayName')] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] [System.String] # New subscription name @@ -138,11 +140,15 @@ begin { } $mapping = @{ - RenameExpanded = 'Az.Subscription.private\Rename-AzSubscription_RenameExpanded'; - RenameViaIdentityExpanded = 'Az.Subscription.private\Rename-AzSubscription_RenameViaIdentityExpanded'; + RenameExpanded = 'Az.Subscription.custom\Rename-AzSubscription'; + RenameViaIdentityExpanded = 'Az.Subscription.custom\Rename-AzSubscription'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Subscription/generate-help.ps1 b/src/Subscription/generate-help.ps1 index f80210e3ff43..b826883815e4 100644 --- a/src/Subscription/generate-help.ps1 +++ b/src/Subscription/generate-help.ps1 @@ -66,8 +66,8 @@ foreach($directory in $directories) $docsPath = Join-Path $docsFolder $directory.Name $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue $examplesPath = Join-Path $examplesFolder $directory.Name - - Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath -AddComplexInterfaceInfo:$addComplexInterfaceInfo Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" } diff --git a/src/Subscription/generate-info.json b/src/Subscription/generate-info.json index e743042625a5..e1067714460d 100644 --- a/src/Subscription/generate-info.json +++ b/src/Subscription/generate-info.json @@ -1,8 +1,8 @@ { - "swagger_commit": "802fc0a5edd13b96e8a6aeadb742657188e9e866", + "swagger_commit": "ec238f30bd6d4a0681b691908fe00b54868467de", "node": "v14.15.5", "autorest": "`-- (empty)", "autorest_core": "3.9.7", "autorest_modelerfour": "4.15.414", - "autorest_powershell": "3.0.509" + "autorest_powershell": "3.0.512" } diff --git a/src/Subscription/generate-portal-ux.ps1 b/src/Subscription/generate-portal-ux.ps1 new file mode 100644 index 000000000000..8440f84f5c53 --- /dev/null +++ b/src/Subscription/generate-portal-ux.ps1 @@ -0,0 +1,375 @@ +# ---------------------------------------------------------------------------------- +# 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. +# +# This Script will create a folder dedicated to Azure-specific content and includes metadata files essential for enhancing the user experience (UX) within the Azure portal. +# These files are utilized by the Azure portal to effectively present the usage of cmdlets related to specific resources on portal pages. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$moduleName = 'Az.Subscription' +$rootModuleName = '' +if ($rootModuleName -eq "") +{ + $rootModuleName = $moduleName +} +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot "./$moduleName.psd1") +$modulePath = $modulePsd1.FullName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot "./bin/$moduleName.private.dll") +$instance = [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName +$parameterSetsInfo = Get-Module -Name "$moduleName.private" + +$buildinFunctions = @("Export-CmdletSurface", "Export-ExampleStub", "Export-FormatPs1xml", "Export-HelpMarkdown", "Export-ModelSurface", "Export-ProxyCmdlet", "Export-Psd1", "Export-TestStub", "Get-CommonParameter", "Get-ModuleGuid", "Get-ScriptCmdlet") + +function Test-FunctionSupported() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + If ($buildinfunctions.Contains($FunctionName)) { + return $false + } + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity")) { + return $false + } + If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) { + return $false + } + + $parameterSetInfo = $parameterSetsInfo.ExportedCmdlets[$FunctionName] + foreach ($parameterInfo in $parameterSetInfo.Parameters.Values) + { + $category = (Get-ParameterAttribute -ParameterInfo $parameterInfo -AttributeName "CategoryAttribute").Categories + $invalideCategory = @('Query', 'Body') + if ($invalideCategory -contains $category) + { + return $false + } + } + + $customFiles = Get-ChildItem -Path custom -Filter "$cmdletName.*" + if ($customFiles.Length -ne 0) + { + return $false + } + + return $true +} + +function Get-MappedCmdletFromFunctionName() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + + return $cmdletName +} + +function Get-ParameterAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo, + [Parameter()] + [String] + $AttributeName + ) + return $ParameterInfo.Attributes | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $CmdletInfo, + [Parameter()] + [String] + $AttributeName + ) + + return $CmdletInfo.ImplementingType.GetTypeInfo().GetCustomAttributes([System.object], $true) | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletDescription() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [String] + $CmdletName + ) + $helpInfo = Get-Help $CmdletName -Full + + $description = $helpInfo.Description.Text + if ($null -eq $description) + { + return "" + } + return $description +} + +# Test whether the parameter is from swagger http path +function Test-ParameterFromSwagger() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo + ) + $category = (Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "CategoryAttribute").Categories + $doNotExport = Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "DoNotExportAttribute" + if ($null -ne $doNotExport) + { + return $false + } + + $valideCategory = @('Path') + if ($valideCategory -contains $category) + { + return $true + } + return $false +} + +function New-ExampleForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $category = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "CategoryAttribute").Categories + $sourceName = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "InfoAttribute").SerializedName + $name = $parameter.Name + $result += [ordered]@{ + name = "-$Name" + value = "[$category.$sourceName]" + } + } + + return $result +} + +function New-ParameterArrayInParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $isMandatory = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "ParameterAttribute").Mandatory + $parameterName = $parameter.Name + $parameterType = $parameter.ParameterType.ToString().Split('.')[1] + if ($parameter.SwitchParameter) + { + $parameterSignature = "-$parameterName" + } + else + { + $parameterSignature = "-$parameterName <$parameterType>" + } + if ($parameterName -eq "SubscriptionId") + { + $isMandatory = $false + } + if (-not $isMandatory) + { + $parameterSignature = "[$parameterSignature]" + } + $result += $parameterSignature + } + + return $result +} + +function New-MetadataForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $httpAttribute = Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "HttpPathAttribute" + $httpPath = $httpAttribute.Path + $apiVersion = $httpAttribute.ApiVersion + $provider = [System.Text.RegularExpressions.Regex]::New("/providers/([\w+\.]+)/").Match($httpPath).Groups[1].Value + $resourcePath = "/" + $httpPath.Split("$provider/")[1] + $resourceType = [System.Text.RegularExpressions.Regex]::New("/([\w]+)/\{\w+\}").Matches($resourcePath) | ForEach-Object {$_.groups[1].Value} | Join-String -Separator "/" + $cmdletName = Get-MappedCmdletFromFunctionName $ParameterSetInfo.Name + $description = (Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "DescriptionAttribute").Description + [object[]]$example = New-ExampleForParameterSet $ParameterSetInfo + [string[]]$signature = New-ParameterArrayInParameterSet $ParameterSetInfo + + return @{ + Path = $httpPath + Provider = $provider + ResourceType = $resourceType + ApiVersion = $apiVersion + CmdletName = $cmdletName + Description = $description + Example = $example + Signature = @{ + parameters = $signature + } + } +} + +function Merge-WithExistCmdletMetadata() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Collections.Specialized.OrderedDictionary] + $ExistedCmdletInfo, + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $ExistedCmdletInfo.help.parameterSets += $ParameterSetMetadata.Signature + $ExistedCmdletInfo.examples += [ordered]@{ + description = $ParameterSetMetadata.Description + parameters = $ParameterSetMetadata.Example + } + + return $ExistedCmdletInfo +} + +function New-MetadataForCmdlet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $cmdletName = $ParameterSetMetadata.CmdletName + $description = Get-CmdletDescription $cmdletName + $result = [ordered]@{ + name = $cmdletName + description = $description + path = $ParameterSetMetadata.Path + help = [ordered]@{ + learnMore = [ordered]@{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName/$cmdletName".ToLower() + } + parameterSets = @() + } + examples = @() + } + $result = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $result -ParameterSetMetadata $ParameterSetMetadata + return $result +} + +$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-functionSupported($_) } +$resourceTypes = @{} +foreach ($parameterSetName in $parameterSets) +{ + $cmdletInfo = $parameterSetsInfo.ExportedCommands[$parameterSetName] + $parameterSetMetadata = New-MetadataForParameterSet -ParameterSetInfo $cmdletInfo + $cmdletName = $parameterSetMetadata.CmdletName + if (-not ($moduleInfo.ExportedCommands.ContainsKey($cmdletName))) + { + continue + } + if ($resourceTypes.ContainsKey($parameterSetMetadata.ResourceType)) + { + $ExistedCmdletInfo = $resourceTypes[$parameterSetMetadata.ResourceType].commands | Where-Object { $_.name -eq $cmdletName } + if ($ExistedCmdletInfo) + { + $ExistedCmdletInfo = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $ExistedCmdletInfo -ParameterSetMetadata $parameterSetMetadata + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType].commands += $cmdletInfo + } + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType] = [ordered]@{ + resourceType = $parameterSetMetadata.ResourceType + apiVersion = $parameterSetMetadata.ApiVersion + learnMore = @{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName".ToLower() + } + commands = @($cmdletInfo) + provider = $parameterSetMetadata.Provider + } + } +} + +$UXFolder = 'UX' +if (Test-Path $UXFolder) +{ + Remove-Item -Path $UXFolder -Recurse +} +$null = New-Item -ItemType Directory -Path $UXFolder + +foreach ($resourceType in $resourceTypes.Keys) +{ + $resourceTypeFileName = $resourceType -replace "/", "-" + if ($resourceTypeFileName -eq "") + { + continue + } + $resourceTypeInfo = $resourceTypes[$resourceType] + $provider = $resourceTypeInfo.provider + $providerFolder = "$UXFolder/$provider" + if (-not (Test-Path $providerFolder)) + { + $null = New-Item -ItemType Directory -Path $providerFolder + } + $resourceTypeInfo.Remove("provider") + $resourceTypeInfo | ConvertTo-Json -Depth 10 | Out-File "$providerFolder/$resourceTypeFileName.json" +} \ No newline at end of file diff --git a/src/Subscription/generated/api/Models/Api20211001/AcceptOwnershipStatusResponse.cs b/src/Subscription/generated/api/Models/Api20211001/AcceptOwnershipStatusResponse.cs index de43be137628..c7728e229e3e 100644 --- a/src/Subscription/generated/api/Models/Api20211001/AcceptOwnershipStatusResponse.cs +++ b/src/Subscription/generated/api/Models/Api20211001/AcceptOwnershipStatusResponse.cs @@ -18,6 +18,7 @@ public partial class AcceptOwnershipStatusResponse : /// The accept ownership state of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 0)] public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.AcceptOwnership? AcceptOwnershipState { get => this._acceptOwnershipState; } /// Backing field for property. @@ -25,6 +26,7 @@ public partial class AcceptOwnershipStatusResponse : /// UPN of the billing owner [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 1)] public string BillingOwner { get => this._billingOwner; } /// Backing field for property. @@ -32,6 +34,7 @@ public partial class AcceptOwnershipStatusResponse : /// The display name of the subscription. [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.DoNotFormat] public string DisplayName { get => this._displayName; set => this._displayName = value; } /// Internal Acessors for AcceptOwnershipState @@ -51,6 +54,7 @@ public partial class AcceptOwnershipStatusResponse : /// The provisioning state of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 2)] public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Provisioning? ProvisioningState { get => this._provisioningState; } /// Backing field for property. @@ -58,6 +62,7 @@ public partial class AcceptOwnershipStatusResponse : /// Newly created subscription Id. [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 3)] public string SubscriptionId { get => this._subscriptionId; } /// Backing field for property. @@ -65,6 +70,7 @@ public partial class AcceptOwnershipStatusResponse : /// Tenant Id of the subscription [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 4)] public string SubscriptionTenantId { get => this._subscriptionTenantId; set => this._subscriptionTenantId = value; } /// Backing field for property. @@ -72,6 +78,7 @@ public partial class AcceptOwnershipStatusResponse : /// Tags for the subscription [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.DoNotFormat] public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponseTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.AcceptOwnershipStatusResponseTags()); set => this._tag = value; } /// Creates an new instance. diff --git a/src/Subscription/generated/api/Models/Api20211001/SubscriptionAliasResponse.cs b/src/Subscription/generated/api/Models/Api20211001/SubscriptionAliasResponse.cs index 3fc080e1faa8..89ccd4d04a69 100644 --- a/src/Subscription/generated/api/Models/Api20211001/SubscriptionAliasResponse.cs +++ b/src/Subscription/generated/api/Models/Api20211001/SubscriptionAliasResponse.cs @@ -48,7 +48,7 @@ public partial class SubscriptionAliasResponse : /// The display name of the subscription. [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Inlined)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 1)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.DoNotFormat] public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponsePropertiesInternal)Property).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponsePropertiesInternal)Property).DisplayName = value ?? null; } /// Backing field for property. @@ -98,7 +98,7 @@ public partial class SubscriptionAliasResponse : /// The provisioning state of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Inlined)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 3)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 2)] public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponsePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponsePropertiesInternal)Property).ProvisioningState = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.ProvisioningState)""); } /// Reseller Id @@ -108,7 +108,7 @@ public partial class SubscriptionAliasResponse : /// Newly created subscription Id. [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Inlined)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 2)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.FormatTable(Index = 1)] public string SubscriptionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponsePropertiesInternal)Property).SubscriptionId; } /// Owner Id of the subscription diff --git a/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.PowerShell.cs b/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.PowerShell.cs new file mode 100644 index 000000000000..a0d90e7d5aea --- /dev/null +++ b/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.PowerShell.cs @@ -0,0 +1,166 @@ +// 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.Subscription.Models.Api20211001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.PowerShell; + + /// The created subscription object. + [System.ComponentModel.TypeConverter(typeof(SubscriptionCreationResultTypeConverter))] + public partial class SubscriptionCreationResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubscriptionCreationResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubscriptionCreationResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubscriptionCreationResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResultInternal)this).SubscriptionLink = (string) content.GetValueForProperty("SubscriptionLink",((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResultInternal)this).SubscriptionLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SubscriptionCreationResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResultInternal)this).SubscriptionLink = (string) content.GetValueForProperty("SubscriptionLink",((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResultInternal)this).SubscriptionLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The created subscription object. + [System.ComponentModel.TypeConverter(typeof(SubscriptionCreationResultTypeConverter))] + public partial interface ISubscriptionCreationResult + + { + + } +} \ No newline at end of file diff --git a/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.TypeConverter.cs b/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.TypeConverter.cs new file mode 100644 index 000000000000..b5acc48fde6f --- /dev/null +++ b/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// 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.Subscription.Models.Api20211001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubscriptionCreationResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubscriptionCreationResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubscriptionCreationResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubscriptionCreationResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.cs b/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.cs new file mode 100644 index 000000000000..bbef8599888d --- /dev/null +++ b/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.cs @@ -0,0 +1,57 @@ +// 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.Subscription.Models.Api20211001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Extensions; + + /// The created subscription object. + public partial class SubscriptionCreationResult : + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult, + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResultInternal + { + + /// Backing field for property. + private string _subscriptionLink; + + /// + /// The link to the new subscription. Use this link to check the status of subscription creation operation. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] + public string SubscriptionLink { get => this._subscriptionLink; set => this._subscriptionLink = value; } + + /// Creates an new instance. + public SubscriptionCreationResult() + { + + } + } + /// The created subscription object. + public partial interface ISubscriptionCreationResult : + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IJsonSerializable + { + /// + /// The link to the new subscription. Use this link to check the status of subscription creation operation. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to the new subscription. Use this link to check the status of subscription creation operation.", + SerializedName = @"subscriptionLink", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionLink { get; set; } + + } + /// The created subscription object. + internal partial interface ISubscriptionCreationResultInternal + + { + /// + /// The link to the new subscription. Use this link to check the status of subscription creation operation. + /// + string SubscriptionLink { get; set; } + + } +} \ No newline at end of file diff --git a/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.json.cs b/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.json.cs new file mode 100644 index 000000000000..868399259ad7 --- /dev/null +++ b/src/Subscription/generated/api/Models/Api20211001/SubscriptionCreationResult.json.cs @@ -0,0 +1,108 @@ +// 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.Subscription.Models.Api20211001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Extensions; + + /// The created subscription object. + public partial class SubscriptionCreationResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject json ? new SubscriptionCreationResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject instance to deserialize from. + internal SubscriptionCreationResult(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subscriptionLink = If( json?.PropertyT("subscriptionLink"), out var __jsonSubscriptionLink) ? (string)__jsonSubscriptionLink : (string)SubscriptionLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._subscriptionLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonString(this._subscriptionLink.ToString()) : null, "subscriptionLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Subscription/generated/api/Models/SubscriptionIdentity.PowerShell.cs b/src/Subscription/generated/api/Models/SubscriptionIdentity.PowerShell.cs index 7968c22ef955..370a1724b8ef 100644 --- a/src/Subscription/generated/api/Models/SubscriptionIdentity.PowerShell.cs +++ b/src/Subscription/generated/api/Models/SubscriptionIdentity.PowerShell.cs @@ -112,6 +112,10 @@ internal SubscriptionIdentity(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); } + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).OperationId, global::System.Convert.ToString); + } if (content.Contains("AliasName")) { ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).AliasName = (string) content.GetValueForProperty("AliasName",((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).AliasName, global::System.Convert.ToString); @@ -145,6 +149,10 @@ internal SubscriptionIdentity(global::System.Management.Automation.PSObject cont { ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); } + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).OperationId, global::System.Convert.ToString); + } if (content.Contains("AliasName")) { ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).AliasName = (string) content.GetValueForProperty("AliasName",((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentityInternal)this).AliasName, global::System.Convert.ToString); diff --git a/src/Subscription/generated/api/Models/SubscriptionIdentity.cs b/src/Subscription/generated/api/Models/SubscriptionIdentity.cs index 60a4393fdb07..2601d0571422 100644 --- a/src/Subscription/generated/api/Models/SubscriptionIdentity.cs +++ b/src/Subscription/generated/api/Models/SubscriptionIdentity.cs @@ -36,6 +36,15 @@ public partial class SubscriptionIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] public string Id { get => this._id; set => this._id = value; } + /// Backing field for property. + private string _operationId; + + /// + /// The operation ID, which can be found from the Location field in the generate recommendation response header. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Origin(Microsoft.Azure.PowerShell.Cmdlets.Subscription.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + /// Backing field for property. private string _subscriptionId; @@ -79,6 +88,16 @@ public partial interface ISubscriptionIdentity : SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] string Id { get; set; } + /// + /// The operation ID, which can be found from the Location field in the generate recommendation response header. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The operation ID, which can be found from the Location field in the generate recommendation response header.", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } /// Subscription Id. [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( Required = false, @@ -101,6 +120,10 @@ internal partial interface ISubscriptionIdentityInternal string BillingAccountId { get; set; } /// Resource identity path string Id { get; set; } + /// + /// The operation ID, which can be found from the Location field in the generate recommendation response header. + /// + string OperationId { get; set; } /// Subscription Id. string SubscriptionId { get; set; } diff --git a/src/Subscription/generated/api/Models/SubscriptionIdentity.json.cs b/src/Subscription/generated/api/Models/SubscriptionIdentity.json.cs index a683ba3dfa10..dd42a5c8aa02 100644 --- a/src/Subscription/generated/api/Models/SubscriptionIdentity.json.cs +++ b/src/Subscription/generated/api/Models/SubscriptionIdentity.json.cs @@ -77,6 +77,7 @@ internal SubscriptionIdentity(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Ru return; } {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} {_aliasName = If( json?.PropertyT("aliasName"), out var __jsonAliasName) ? (string)__jsonAliasName : (string)AliasName;} {_billingAccountId = If( json?.PropertyT("billingAccountId"), out var __jsonBillingAccountId) ? (string)__jsonBillingAccountId : (string)BillingAccountId;} {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} @@ -103,6 +104,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode ToJ return container; } AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); AddIf( null != (((object)this._aliasName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonString(this._aliasName.ToString()) : null, "aliasName" ,container.Add ); AddIf( null != (((object)this._billingAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonString(this._billingAccountId.ToString()) : null, "billingAccountId" ,container.Add ); AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); diff --git a/src/Subscription/generated/api/Subscription.cs b/src/Subscription/generated/api/Subscription.cs index 92a05889cfc0..075f33e51277 100644 --- a/src/Subscription/generated/api/Subscription.cs +++ b/src/Subscription/generated/api/Subscription.cs @@ -1746,6 +1746,167 @@ public partial class Subscription } } + /// Get the status of the pending Microsoft.Subscription API operations. + /// The operation ID, which can be found from the Location field in the generate recommendation + /// response header. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SubscriptionOperationGet(string operationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func onAccepted, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Subscription/subscriptionOperations/" + + global::System.Uri.EscapeDataString(operationId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SubscriptionOperationGet_Call(request,onOk,onAccepted,onDefault,eventListener,sender); + } + } + + /// Get the status of the pending Microsoft.Subscription API operations. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SubscriptionOperationGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func onAccepted, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Subscription/subscriptionOperations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Subscription/subscriptionOperations/{operationId}'"); + } + + // replace URI parameters with values from identity + var operationId = _match.Groups["operationId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Subscription/subscriptionOperations/" + + operationId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SubscriptionOperationGet_Call(request,onOk,onAccepted,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SubscriptionOperationGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func onAccepted, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.SubscriptionCreationResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Accepted: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onAccepted(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ErrorResponseBody.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The operation ID, which can be found from the Location field in the generate recommendation + /// response header. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SubscriptionOperationGet_Validate(string operationId, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(operationId),operationId); + } + } + /// Create or Update Subscription tenant policy for user's tenant. /// Put tenant policy request properties. /// a delegate that is called when the remote service returns 200 (OK). diff --git a/src/Subscription/generated/cmdlets/DisableAzSubscription_Cancel.cs b/src/Subscription/generated/cmdlets/DisableAzSubscription_Cancel.cs index 13583e3133fb..ace73dbd8592 100644 --- a/src/Subscription/generated/cmdlets/DisableAzSubscription_Cancel.cs +++ b/src/Subscription/generated/cmdlets/DisableAzSubscription_Cancel.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(string))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"The operation to cancel a subscription")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel", ApiVersion = "2021-10-01")] public partial class DisableAzSubscription_Cancel : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/DisableAzSubscription_CancelViaIdentity.cs b/src/Subscription/generated/cmdlets/DisableAzSubscription_CancelViaIdentity.cs index bcd9c4ee49f7..8d1eb18a967f 100644 --- a/src/Subscription/generated/cmdlets/DisableAzSubscription_CancelViaIdentity.cs +++ b/src/Subscription/generated/cmdlets/DisableAzSubscription_CancelViaIdentity.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(string))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"The operation to cancel a subscription")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel", ApiVersion = "2021-10-01")] public partial class DisableAzSubscription_CancelViaIdentity : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/EnableAzSubscription_Enable.cs b/src/Subscription/generated/cmdlets/EnableAzSubscription_Enable.cs index f44ff23ec7b0..a85ff382d231 100644 --- a/src/Subscription/generated/cmdlets/EnableAzSubscription_Enable.cs +++ b/src/Subscription/generated/cmdlets/EnableAzSubscription_Enable.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(string))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"The operation to enable a subscription")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable", ApiVersion = "2021-10-01")] public partial class EnableAzSubscription_Enable : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/EnableAzSubscription_EnableViaIdentity.cs b/src/Subscription/generated/cmdlets/EnableAzSubscription_EnableViaIdentity.cs index 361d36fd405d..22c60f7a9000 100644 --- a/src/Subscription/generated/cmdlets/EnableAzSubscription_EnableViaIdentity.cs +++ b/src/Subscription/generated/cmdlets/EnableAzSubscription_EnableViaIdentity.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(string))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"The operation to enable a subscription")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable", ApiVersion = "2021-10-01")] public partial class EnableAzSubscription_EnableViaIdentity : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs b/src/Subscription/generated/cmdlets/GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs index 8e0987b5b88d..0362f313a792 100644 --- a/src/Subscription/generated/cmdlets/GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs +++ b/src/Subscription/generated/cmdlets/GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs @@ -12,10 +12,12 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets /// /// [OpenAPI] AcceptOwnershipStatus=>GET:"/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus" /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSubscriptionAcceptOwnershipStatus_AcceptExpanded")] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Accept subscription ownership status.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus", ApiVersion = "2021-10-01")] public partial class GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/GetAzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded.cs b/src/Subscription/generated/cmdlets/GetAzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded.cs index c2483d34be98..4459905a8752 100644 --- a/src/Subscription/generated/cmdlets/GetAzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded.cs +++ b/src/Subscription/generated/cmdlets/GetAzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded.cs @@ -12,10 +12,12 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets /// /// [OpenAPI] AcceptOwnershipStatus=>GET:"/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus" /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded")] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Accept subscription ownership status.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus", ApiVersion = "2021-10-01")] public partial class GetAzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_Get.cs b/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_Get.cs index f67a16c2dfa6..750a145b335b 100644 --- a/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_Get.cs +++ b/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Get Alias Subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/aliases/{aliasName}", ApiVersion = "2021-10-01")] public partial class GetAzSubscriptionAlias_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_GetViaIdentity.cs b/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_GetViaIdentity.cs index 529159223664..f288d472dfcf 100644 --- a/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_GetViaIdentity.cs +++ b/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_GetViaIdentity.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Get Alias Subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/aliases/{aliasName}", ApiVersion = "2021-10-01")] public partial class GetAzSubscriptionAlias_GetViaIdentity : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_List.cs b/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_List.cs index 21488c4d0f46..57fa4e1390fd 100644 --- a/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_List.cs +++ b/src/Subscription/generated/cmdlets/GetAzSubscriptionAlias_List.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasListResult))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"List Alias Subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/aliases", ApiVersion = "2021-10-01")] public partial class GetAzSubscriptionAlias_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_Get.cs b/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_Get.cs new file mode 100644 index 000000000000..1f3d527c191b --- /dev/null +++ b/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_Get.cs @@ -0,0 +1,414 @@ +// 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.Subscription.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Extensions; + using System; + + /// Get the status of the pending Microsoft.Subscription API operations. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Subscription/subscriptionOperations/{operationId}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSubscriptionOperation_Get")] + [global::System.Management.Automation.OutputType(typeof(string))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Get the status of the pending Microsoft.Subscription API operations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/subscriptionOperations/{operationId}", ApiVersion = "2021-10-01")] + public partial class GetAzSubscriptionOperation_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Subscription Client => Microsoft.Azure.PowerShell.Cmdlets.Subscription.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _operationId; + + /// + /// The operation ID, which can be found from the Location field in the generate recommendation response header. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The operation ID, which can be found from the Location field in the generate recommendation response header.")] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The operation ID, which can be found from the Location field in the generate recommendation response header.", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Path)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnAccepted will be called before the regular onAccepted has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onAccepted method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnAccepted(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IErrorResponseBody + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Subscription.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSubscriptionOperation_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Subscription.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Subscription.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SubscriptionOperationGet(OperationId, onOk, onAccepted, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OperationId=OperationId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 202 (Accepted). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onAccepted(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnAccepted(responseMessage, ref _returnNow); + // if overrideOnAccepted has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onAccepted - response for 202 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IErrorResponseBody + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OperationId=OperationId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OperationId=OperationId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult + WriteObject((await response).SubscriptionLink); + } + } + } +} \ No newline at end of file diff --git a/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_GetViaIdentity.cs b/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_GetViaIdentity.cs new file mode 100644 index 000000000000..f0942f9340f3 --- /dev/null +++ b/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_GetViaIdentity.cs @@ -0,0 +1,418 @@ +// 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.Subscription.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Extensions; + using System; + + /// Get the status of the pending Microsoft.Subscription API operations. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Subscription/subscriptionOperations/{operationId}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSubscriptionOperation_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(string))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Get the status of the pending Microsoft.Subscription API operations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/subscriptionOperations/{operationId}", ApiVersion = "2021-10-01")] + public partial class GetAzSubscriptionOperation_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Subscription Client => Microsoft.Azure.PowerShell.Cmdlets.Subscription.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnAccepted will be called before the regular onAccepted has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onAccepted method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnAccepted(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IErrorResponseBody + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Subscription.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSubscriptionOperation_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Subscription.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Subscription.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.SubscriptionOperationGetViaIdentity(InputObject.Id, onOk, onAccepted, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.OperationId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OperationId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.SubscriptionOperationGet(InputObject.OperationId ?? null, onOk, onAccepted, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 202 (Accepted). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onAccepted(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnAccepted(responseMessage, ref _returnNow); + // if overrideOnAccepted has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onAccepted - response for 202 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IErrorResponseBody + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionCreationResult + WriteObject((await response).SubscriptionLink); + } + } + } +} \ No newline at end of file diff --git a/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_List.cs b/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_List.cs index 838ab8558f62..3737009f9f59 100644 --- a/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_List.cs +++ b/src/Subscription/generated/cmdlets/GetAzSubscriptionOperation_List.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IOperation))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Lists all of the available Microsoft.Subscription API operations.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/operations", ApiVersion = "2021-10-01")] public partial class GetAzSubscriptionOperation_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/GetAzSubscriptionPolicy_List.cs b/src/Subscription/generated/cmdlets/GetAzSubscriptionPolicy_List.cs index 5c26ac6cfdb1..e3330b68453a 100644 --- a/src/Subscription/generated/cmdlets/GetAzSubscriptionPolicy_List.cs +++ b/src/Subscription/generated/cmdlets/GetAzSubscriptionPolicy_List.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Get the subscription tenant policy for the user's tenant.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/policies", ApiVersion = "2021-10-01")] public partial class GetAzSubscriptionPolicy_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs b/src/Subscription/generated/cmdlets/InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs index 9b914fa57e01..3b6e4b52afea 100644 --- a/src/Subscription/generated/cmdlets/InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs +++ b/src/Subscription/generated/cmdlets/InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Accept subscription ownership.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership", ApiVersion = "2021-10-01")] public partial class InvokeAzSubscriptionAcceptOwnership_AcceptExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { @@ -59,17 +60,6 @@ public partial class InvokeAzSubscriptionAcceptOwnership_AcceptExpanded : global [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } - /// The friendly name of the subscription. - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the subscription.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Body)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"The friendly name of the subscription.", - SerializedName = @"displayName", - PossibleTypes = new [] { typeof(string) })] - public string DisplayName { get => _body.DisplayName ?? null; set => _body.DisplayName = value; } - /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -158,6 +148,18 @@ public partial class InvokeAzSubscriptionAcceptOwnership_AcceptExpanded : global [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + /// The friendly name of the subscription. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the subscription.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("DisplayName")] + public string SubscriptionName { get => _body.DisplayName ?? null; set => _body.DisplayName = value; } + /// Tags for the subscription [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ExportAs(typeof(global::System.Collections.Hashtable))] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tags for the subscription")] diff --git a/src/Subscription/generated/cmdlets/InvokeAzSubscriptionAcceptOwnership_AcceptViaIdentityExpanded.cs b/src/Subscription/generated/cmdlets/InvokeAzSubscriptionAcceptOwnership_AcceptViaIdentityExpanded.cs index 8f3511618327..8a4208e573ee 100644 --- a/src/Subscription/generated/cmdlets/InvokeAzSubscriptionAcceptOwnership_AcceptViaIdentityExpanded.cs +++ b/src/Subscription/generated/cmdlets/InvokeAzSubscriptionAcceptOwnership_AcceptViaIdentityExpanded.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Accept subscription ownership.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership", ApiVersion = "2021-10-01")] public partial class InvokeAzSubscriptionAcceptOwnership_AcceptViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { @@ -59,17 +60,6 @@ public partial class InvokeAzSubscriptionAcceptOwnership_AcceptViaIdentityExpand [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } - /// The friendly name of the subscription. - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the subscription.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Body)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"The friendly name of the subscription.", - SerializedName = @"displayName", - PossibleTypes = new [] { typeof(string) })] - public string DisplayName { get => _body.DisplayName ?? null; set => _body.DisplayName = value; } - /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -148,6 +138,18 @@ public partial class InvokeAzSubscriptionAcceptOwnership_AcceptViaIdentityExpand [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + /// The friendly name of the subscription. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the subscription.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("DisplayName")] + public string SubscriptionName { get => _body.DisplayName ?? null; set => _body.DisplayName = value; } + /// Tags for the subscription [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ExportAs(typeof(global::System.Collections.Hashtable))] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tags for the subscription")] diff --git a/src/Subscription/generated/cmdlets/NewAzSubscriptionAlias_CreateExpanded.cs b/src/Subscription/generated/cmdlets/NewAzSubscriptionAlias_CreateExpanded.cs index dbf94f17662c..dfbe24c229c5 100644 --- a/src/Subscription/generated/cmdlets/NewAzSubscriptionAlias_CreateExpanded.cs +++ b/src/Subscription/generated/cmdlets/NewAzSubscriptionAlias_CreateExpanded.cs @@ -12,10 +12,12 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets /// /// [OpenAPI] Create=>PUT:"/providers/Microsoft.Subscription/aliases/{aliasName}" /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSubscriptionAlias_CreateExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Create Alias Subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/aliases/{aliasName}", ApiVersion = "2021-10-01")] public partial class NewAzSubscriptionAlias_CreateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { @@ -90,17 +92,6 @@ public partial class NewAzSubscriptionAlias_CreateExpanded : global::System.Mana [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } - /// The friendly name of the subscription. - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the subscription.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Body)] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"The friendly name of the subscription.", - SerializedName = @"displayName", - PossibleTypes = new [] { typeof(string) })] - public string DisplayName { get => _body.DisplayName ?? null; set => _body.DisplayName = value; } - /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -190,6 +181,18 @@ public partial class NewAzSubscriptionAlias_CreateExpanded : global::System.Mana public string SubscriptionId { get => _body.SubscriptionId ?? null; set => _body.SubscriptionId = value; } + /// The friendly name of the subscription. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the subscription.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("DisplayName")] + public string SubscriptionName { get => _body.DisplayName ?? null; set => _body.DisplayName = value; } + /// Owner Id of the subscription [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Owner Id of the subscription")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.ParameterCategory.Body)] diff --git a/src/Subscription/generated/cmdlets/RemoveAzSubscriptionAlias_Delete.cs b/src/Subscription/generated/cmdlets/RemoveAzSubscriptionAlias_Delete.cs index d8f69dc5aee4..ec139250623f 100644 --- a/src/Subscription/generated/cmdlets/RemoveAzSubscriptionAlias_Delete.cs +++ b/src/Subscription/generated/cmdlets/RemoveAzSubscriptionAlias_Delete.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Delete Alias.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/aliases/{aliasName}", ApiVersion = "2021-10-01")] public partial class RemoveAzSubscriptionAlias_Delete : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/RemoveAzSubscriptionAlias_DeleteViaIdentity.cs b/src/Subscription/generated/cmdlets/RemoveAzSubscriptionAlias_DeleteViaIdentity.cs index 2e220d4a8d84..8c8700fefffc 100644 --- a/src/Subscription/generated/cmdlets/RemoveAzSubscriptionAlias_DeleteViaIdentity.cs +++ b/src/Subscription/generated/cmdlets/RemoveAzSubscriptionAlias_DeleteViaIdentity.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Delete Alias.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/aliases/{aliasName}", ApiVersion = "2021-10-01")] public partial class RemoveAzSubscriptionAlias_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/RenameAzSubscription_RenameExpanded.cs b/src/Subscription/generated/cmdlets/RenameAzSubscription_RenameExpanded.cs index feb29e8057a4..603410fcd849 100644 --- a/src/Subscription/generated/cmdlets/RenameAzSubscription_RenameExpanded.cs +++ b/src/Subscription/generated/cmdlets/RenameAzSubscription_RenameExpanded.cs @@ -12,10 +12,12 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets /// /// [OpenAPI] Rename=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename" /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Rename, @"AzSubscription_RenameExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(string))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"The operation to rename a subscription")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename", ApiVersion = "2021-10-01")] public partial class RenameAzSubscription_RenameExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/RenameAzSubscription_RenameViaIdentityExpanded.cs b/src/Subscription/generated/cmdlets/RenameAzSubscription_RenameViaIdentityExpanded.cs index 73ae54e4826e..3c5d00cedcb1 100644 --- a/src/Subscription/generated/cmdlets/RenameAzSubscription_RenameViaIdentityExpanded.cs +++ b/src/Subscription/generated/cmdlets/RenameAzSubscription_RenameViaIdentityExpanded.cs @@ -12,10 +12,12 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets /// /// [OpenAPI] Rename=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename" /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Rename, @"AzSubscription_RenameViaIdentityExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(string))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"The operation to rename a subscription")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename", ApiVersion = "2021-10-01")] public partial class RenameAzSubscription_RenameViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/cmdlets/UpdateAzSubscriptionPolicy_AddExpanded.cs b/src/Subscription/generated/cmdlets/UpdateAzSubscriptionPolicy_AddExpanded.cs index 1b6a15135bd9..c5666d7f8b19 100644 --- a/src/Subscription/generated/cmdlets/UpdateAzSubscriptionPolicy_AddExpanded.cs +++ b/src/Subscription/generated/cmdlets/UpdateAzSubscriptionPolicy_AddExpanded.cs @@ -12,10 +12,12 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Cmdlets /// /// [OpenAPI] AddUpdatePolicyForTenant=>PUT:"/providers/Microsoft.Subscription/policies/default" /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSubscriptionPolicy_AddExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Description(@"Create or Update Subscription tenant policy for user's tenant.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Subscription.HttpPath(Path = "/providers/Microsoft.Subscription/policies/default", ApiVersion = "2021-10-01")] public partial class UpdateAzSubscriptionPolicy_AddExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.IEventListener { diff --git a/src/Subscription/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/Subscription/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs index 41ca501a6268..b77b5c1e48be 100644 --- a/src/Subscription/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs +++ b/src/Subscription/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -33,6 +33,9 @@ public class ExportHelpMarkdown : PSCmdlet [ValidateNotNullOrEmpty] public string ExamplesFolder { get; set; } + [Parameter()] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + protected override void ProcessRecord() { try @@ -41,7 +44,7 @@ protected override void ProcessRecord() var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); - WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder, AddComplexInterfaceInfo.IsPresent); } catch (Exception ee) { diff --git a/src/Subscription/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/Subscription/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs index 7504bd51592e..4723ae21edab 100644 --- a/src/Subscription/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +++ b/src/Subscription/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -52,6 +52,9 @@ public class ExportProxyCmdlet : PSCmdlet [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] public SwitchParameter ExcludeDocs { get; set; } + [Parameter(ParameterSetName = "Docs")] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + protected override void ProcessRecord() { try @@ -163,7 +166,7 @@ protected override void ProcessRecord() var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; - WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder); + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder, AddComplexInterfaceInfo.IsPresent); } } } diff --git a/src/Subscription/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/Subscription/generated/runtime/BuildTime/MarkdownRenderer.cs index 36f5478739e7..7921e3672c9b 100644 --- a/src/Subscription/generated/runtime/BuildTime/MarkdownRenderer.cs +++ b/src/Subscription/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.PowerShell { internal static class MarkdownRenderer { - public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder) + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder, bool AddComplexInterfaceInfo = true) { Directory.CreateDirectory(docsFolder); var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); @@ -69,18 +69,26 @@ public static void WriteMarkdowns(IEnumerable variantGroups, PsMod } sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); - sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); - foreach (var alias in markdownInfo.Aliases) + if (markdownInfo.Aliases.Any()) { - sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); } - if (markdownInfo.ComplexInterfaceInfos.Any()) + foreach (var alias in markdownInfo.Aliases) { - sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); } - foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + + if (AddComplexInterfaceInfo) { - sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + } sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); diff --git a/src/Subscription/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/Subscription/generated/runtime/BuildTime/Models/PsProxyOutputs.cs index eb1a30021310..af7540c2e82f 100644 --- a/src/Subscription/generated/runtime/BuildTime/Models/PsProxyOutputs.cs +++ b/src/Subscription/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -191,8 +191,15 @@ public BeginOutput(VariantGroup variantGroup) : base(variantGroup) public string GetProcessCustomAttributesAtRuntime() { - return VariantGroup.IsInternal ? "" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; + return VariantGroup.IsInternal ? "" : IsAzure ? $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet] +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) +{Indent}{Indent}}}" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; } + private string GetTelemetry() { if (!VariantGroup.IsInternal && IsAzure) diff --git a/src/Subscription/generated/runtime/BuildTime/PsAttributes.cs b/src/Subscription/generated/runtime/BuildTime/PsAttributes.cs index 529ab4442bc0..c994b36a1505 100644 --- a/src/Subscription/generated/runtime/BuildTime/PsAttributes.cs +++ b/src/Subscription/generated/runtime/BuildTime/PsAttributes.cs @@ -48,6 +48,13 @@ public ProfileAttribute(params string[] profiles) } } + [AttributeUsage(AttributeTargets.Class)] + public class HttpPathAttribute : Attribute + { + public string Path { get; set; } + public string ApiVersion { get; set; } + } + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class CategoryAttribute : Attribute { diff --git a/src/Subscription/generated/runtime/MessageAttribute.cs b/src/Subscription/generated/runtime/MessageAttribute.cs index 0916f07b431e..a4a6d2b22adc 100644 --- a/src/Subscription/generated/runtime/MessageAttribute.cs +++ b/src/Subscription/generated/runtime/MessageAttribute.cs @@ -168,6 +168,11 @@ public class PreviewMessageAttribute : Attribute { public string _message; + public DateTime EstimatedGaDate { get; } + + public bool IsEstimatedGaDateSet { get; } = false; + + public PreviewMessageAttribute() { this._message = Resources.PreviewCmdletMessage; @@ -175,12 +180,26 @@ public PreviewMessageAttribute() public PreviewMessageAttribute(string message) { - this._message = message; + this._message = string.IsNullOrEmpty(message) ? Resources.PreviewCmdletMessage : message; } - public void PrintCustomAttributeInfo(System.Management.Automation.PSCmdlet psCmdlet) + public PreviewMessageAttribute(string message, string estimatedDateOfGa) : this(message) + { + if (DateTime.TryParse(estimatedDateOfGa, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.EstimatedGaDate = result; + this.IsEstimatedGaDateSet = true; + } + } + + public void PrintCustomAttributeInfo(Action writeOutput) { - psCmdlet.WriteWarning(this._message); + writeOutput(this._message); + + if (IsEstimatedGaDateSet) + { + writeOutput(string.Format(Resources.PreviewCmdletETAMessage, this.EstimatedGaDate.ToShortDateString())); + } } public virtual bool IsApplicableToInvocation(InvocationInfo invocation) diff --git a/src/Subscription/generated/runtime/MessageAttributeHelper.cs b/src/Subscription/generated/runtime/MessageAttributeHelper.cs index 1bf2a730f95a..e7521c18d297 100644 --- a/src/Subscription/generated/runtime/MessageAttributeHelper.cs +++ b/src/Subscription/generated/runtime/MessageAttributeHelper.cs @@ -35,7 +35,7 @@ public class MessageAttributeHelper * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, * We only process the Parameter beaking change attributes attached only params listed in this list (if present) * */ - public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet, bool showPreviewMessage = true) { bool supressWarningOrError = false; @@ -57,36 +57,49 @@ public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, Inv { psCmdlet.WriteWarning("The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription."); } + + ProcessBreakingChangeAttributesAtRuntime(commandInfo, invocationInfo, parameterSet, psCmdlet); + + } + + private static void ProcessBreakingChangeAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { List attributes = new List(GetAllBreakingChangeAttributesInType(commandInfo, invocationInfo, parameterSet)); StringBuilder sb = new StringBuilder(); - Action appendBreakingChangeInfo = (string s) => sb.Append(s); + Action appendAttributeMessage = (string s) => sb.Append(s); if (attributes != null && attributes.Count > 0) { - appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); foreach (GenericBreakingChangeAttribute attribute in attributes) { - attribute.PrintCustomAttributeInfo(appendBreakingChangeInfo); + attribute.PrintCustomAttributeInfo(appendAttributeMessage); } - appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); psCmdlet.WriteWarning(sb.ToString()); } + } + + public static void ProcessPreviewMessageAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { List previewAttributes = new List(GetAllPreviewAttributesInType(commandInfo, invocationInfo)); + StringBuilder sb = new StringBuilder(); + Action appendAttributeMessage = (string s) => sb.Append(s); if (previewAttributes != null && previewAttributes.Count > 0) { foreach (PreviewMessageAttribute attribute in previewAttributes) { - attribute.PrintCustomAttributeInfo(psCmdlet); + attribute.PrintCustomAttributeInfo(appendAttributeMessage); } + psCmdlet.WriteWarning(sb.ToString()); } } - /** * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) * And returns all the deprecation attributes attached to it @@ -128,6 +141,12 @@ private static IEnumerable GetAllBreakingChangeA } return invocationInfo == null ? attributeList : attributeList.Where(e => e.GetType() == typeof(ParameterSetBreakingChangeAttribute) ? ((ParameterSetBreakingChangeAttribute)e).IsApplicableToInvocation(invocationInfo, parameterSet) : e.IsApplicableToInvocation(invocationInfo)); } + + public static bool ContainsPreviewAttribute(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + return GetAllPreviewAttributesInType(commandInfo, invocationInfo)?.Count() > 0; + } + private static IEnumerable GetAllPreviewAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo) { List attributeList = new List(); diff --git a/src/Subscription/generated/runtime/Properties/Resources.Designer.cs b/src/Subscription/generated/runtime/Properties/Resources.Designer.cs index 9377e0cafd98..024980c14332 100644 --- a/src/Subscription/generated/runtime/Properties/Resources.Designer.cs +++ b/src/Subscription/generated/runtime/Properties/Resources.Designer.cs @@ -3135,7 +3135,16 @@ public static string PortalInstructionsGit } /// - /// Looks up a localized string similar to This cmdlet is in preview. The functionality may not be available in the selected subscription. + /// Looks up a localized string similar to The estimated generally available date is '{0}'.. + /// + public static string PreviewCmdletETAMessage { + get { + return ResourceManager.GetString("PreviewCmdletETAMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is in preview. Its behavior is subject to change based on customer feedback.. /// public static string PreviewCmdletMessage { diff --git a/src/Subscription/generated/runtime/Properties/Resources.resx b/src/Subscription/generated/runtime/Properties/Resources.resx index 613700a3a418..a08a2e50172b 100644 --- a/src/Subscription/generated/runtime/Properties/Resources.resx +++ b/src/Subscription/generated/runtime/Properties/Resources.resx @@ -1736,7 +1736,10 @@ The type of the parameter is changing from '{0}' to '{1}'. Note : Go to {0} for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell. - This cmdlet is in preview. The functionality may not be available in the selected subscription. + This cmdlet is in preview. Its behavior is subject to change based on customer feedback. + + + The estimated generally available date is '{0}'. - The change is expected to take effect from Az version : '{0}' diff --git a/src/Subscription/help/Az.Subscription.md b/src/Subscription/help/Az.Subscription.md index 2ab8f8c1128c..ef59866ed77b 100644 --- a/src/Subscription/help/Az.Subscription.md +++ b/src/Subscription/help/Az.Subscription.md @@ -38,6 +38,3 @@ Delete Alias. ### [Rename-AzSubscription](Rename-AzSubscription.md) The operation to rename a subscription -### [Update-AzSubscriptionPolicy](Update-AzSubscriptionPolicy.md) -Create or Update Subscription tenant policy for user's tenant. - diff --git a/src/Subscription/help/Disable-AzSubscription.md b/src/Subscription/help/Disable-AzSubscription.md index 6e60e5d5045a..f9b65937f850 100644 --- a/src/Subscription/help/Disable-AzSubscription.md +++ b/src/Subscription/help/Disable-AzSubscription.md @@ -129,18 +129,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[AliasName ]`: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - - `[BillingAccountId ]`: Billing Account Id. - - `[Id ]`: Resource identity path - - `[SubscriptionId ]`: Subscription Id. - ## RELATED LINKS diff --git a/src/Subscription/help/Enable-AzSubscription.md b/src/Subscription/help/Enable-AzSubscription.md index 8a0776ba0eea..81180ce5e18a 100644 --- a/src/Subscription/help/Enable-AzSubscription.md +++ b/src/Subscription/help/Enable-AzSubscription.md @@ -129,18 +129,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[AliasName ]`: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - - `[BillingAccountId ]`: Billing Account Id. - - `[Id ]`: Resource identity path - - `[SubscriptionId ]`: Subscription Id. - ## RELATED LINKS diff --git a/src/Subscription/help/Get-AzSubscriptionAcceptOwnershipStatus.md b/src/Subscription/help/Get-AzSubscriptionAcceptOwnershipStatus.md index 22f8984ef579..55fde4dfe77d 100644 --- a/src/Subscription/help/Get-AzSubscriptionAcceptOwnershipStatus.md +++ b/src/Subscription/help/Get-AzSubscriptionAcceptOwnershipStatus.md @@ -14,7 +14,7 @@ Accept subscription ownership status. ### AcceptExpanded (Default) ``` -Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId [-DefaultProfile ] +Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId [-DefaultProfile ] [] ``` @@ -35,9 +35,9 @@ Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX- ``` ```output -AcceptOwnershipState BillingOwner DisplayName ProvisioningState SubscriptionId SubscriptionTenantId --------------------- ------------ ----------- ----------------- -------------- -------------------- -Completed xxxxxxxx@xxxx.com create18 Pending XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +AcceptOwnershipState BillingOwner ProvisioningState SubscriptionId SubscriptionTenantId +-------------------- ------------ ----------------- -------------- -------------------- +Completed xxxxxxxx@xxxx.com Pending XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX ``` Accept subscription ownership status. @@ -80,7 +80,7 @@ Accept wildcard characters: False Subscription Id. ```yaml -Type: System.String[] +Type: System.String Parameter Sets: AcceptExpanded Aliases: @@ -104,18 +104,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[AliasName ]`: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - - `[BillingAccountId ]`: Billing Account Id. - - `[Id ]`: Resource identity path - - `[SubscriptionId ]`: Subscription Id. - ## RELATED LINKS diff --git a/src/Subscription/help/Get-AzSubscriptionAlias.md b/src/Subscription/help/Get-AzSubscriptionAlias.md index f05ddf4767f8..31e480ac5eeb 100644 --- a/src/Subscription/help/Get-AzSubscriptionAlias.md +++ b/src/Subscription/help/Get-AzSubscriptionAlias.md @@ -38,10 +38,10 @@ Get-AzSubscriptionAlias ``` ```output -AliasName DisplayName SubscriptionId ProvisioningState ---------- ----------- -------------- ----------------- -test-subscription createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded -test-subscription2 createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +AliasName SubscriptionId ProvisioningState +--------- -------------- ----------------- +test-subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +test-subscription2 XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded ``` List Alias Subscription. @@ -52,9 +52,9 @@ Get-AzSubscriptionAlias -AliasName test-subscription ``` ```output -AliasName DisplayName SubscriptionId ProvisioningState ---------- ----------- -------------- ----------------- -test-subscription createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +AliasName SubscriptionId ProvisioningState +--------- -------------- ----------------- +test-subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded ``` Get Alias Subscription. @@ -124,18 +124,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[AliasName ]`: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - - `[BillingAccountId ]`: Billing Account Id. - - `[Id ]`: Resource identity path - - `[SubscriptionId ]`: Subscription Id. - ## RELATED LINKS diff --git a/src/Subscription/help/Get-AzSubscriptionPolicy.md b/src/Subscription/help/Get-AzSubscriptionPolicy.md index e5e80f673e6e..c744eb09f88b 100644 --- a/src/Subscription/help/Get-AzSubscriptionPolicy.md +++ b/src/Subscription/help/Get-AzSubscriptionPolicy.md @@ -63,7 +63,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - ## RELATED LINKS diff --git a/src/Subscription/help/Invoke-AzSubscriptionAcceptOwnership.md b/src/Subscription/help/Invoke-AzSubscriptionAcceptOwnership.md index a742b699509a..abe05c5e110f 100644 --- a/src/Subscription/help/Invoke-AzSubscriptionAcceptOwnership.md +++ b/src/Subscription/help/Invoke-AzSubscriptionAcceptOwnership.md @@ -14,15 +14,15 @@ Accept subscription ownership. ### AcceptExpanded (Default) ``` -Invoke-AzSubscriptionAcceptOwnership -SubscriptionId [-DisplayName ] - [-ManagementGroupId ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] +Invoke-AzSubscriptionAcceptOwnership -SubscriptionId [-ManagementGroupId ] + [-SubscriptionName ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] ``` ### AcceptViaIdentityExpanded ``` -Invoke-AzSubscriptionAcceptOwnership -InputObject [-DisplayName ] - [-ManagementGroupId ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] +Invoke-AzSubscriptionAcceptOwnership -InputObject [-ManagementGroupId ] + [-SubscriptionName ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] ``` @@ -33,7 +33,7 @@ Accept subscription ownership. ### Example 1: Accept subscription ownership. ```powershell -Invoke-AzSubscriptionAcceptOwnership -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -DisplayName "createSub" -Tag @{"abc"="123"} -PassThru +Invoke-AzSubscriptionAcceptOwnership -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -SubscriptionName "createSub" -Tag @{"abc"="123"} -PassThru ``` ```output @@ -75,21 +75,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -DisplayName -The friendly name of the subscription. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -InputObject Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table. @@ -166,6 +151,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -SubscriptionName +The friendly name of the subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: DisplayName + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Tag Tags for the subscription @@ -225,18 +225,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[AliasName ]`: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - - `[BillingAccountId ]`: Billing Account Id. - - `[Id ]`: Resource identity path - - `[SubscriptionId ]`: Subscription Id. - ## RELATED LINKS diff --git a/src/Subscription/help/New-AzSubscriptionAlias.md b/src/Subscription/help/New-AzSubscriptionAlias.md index eaa9c8b387c4..ef817a3199f2 100644 --- a/src/Subscription/help/New-AzSubscriptionAlias.md +++ b/src/Subscription/help/New-AzSubscriptionAlias.md @@ -12,13 +12,20 @@ Create Alias Subscription. ## SYNTAX +### CreateExpanded (Default) ``` -New-AzSubscriptionAlias -AliasName [-BillingScope ] [-DisplayName ] - [-ManagementGroupId ] [-ResellerId ] [-SubscriptionId ] - [-SubscriptionOwnerId ] [-SubscriptionTenantId ] [-Tag ] [-Workload ] +New-AzSubscriptionAlias -AliasName -SubscriptionId [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] ``` +### WorkloadCreateExpanded +``` +New-AzSubscriptionAlias -AliasName -BillingScope -SubscriptionName + -Workload [-ManagementGroupId ] [-ResellerId ] [-SubscriptionOwnerId ] + [-SubscriptionTenantId ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + ## DESCRIPTION Create Alias Subscription. @@ -30,22 +37,22 @@ New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XX ``` ```output -AliasName DisplayName SubscriptionId ProvisioningState ---------- ----------- -------------- ----------------- -test-subscription createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +AliasName SubscriptionId ProvisioningState +--------- -------------- ----------------- +test-subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded ``` Create Alias Subscription. ### Example 2: Create Alias Subscription. ```powershell -New-AzSubscriptionAlias -AliasName test-subscription -DisplayName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' ``` ```output -AliasName DisplayName SubscriptionId ProvisioningState ---------- ----------- -------------- ----------------- -test-subscription createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded +AliasName SubscriptionId ProvisioningState +--------- -------------- ----------------- +test-subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded ``` Create Alias Subscription. @@ -88,10 +95,10 @@ Billing scope of the subscription.For CustomerLed and FieldLed - /billingAccount ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: WorkloadCreateExpanded Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -114,27 +121,12 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -DisplayName -The friendly name of the subscription. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ManagementGroupId Management group Id for the subscription. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: WorkloadCreateExpanded Aliases: Required: False @@ -164,7 +156,7 @@ Reseller Id ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: WorkloadCreateExpanded Aliases: Required: False @@ -179,10 +171,25 @@ This parameter can be used to create alias for existing subscription Id ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded Aliases: -Required: False +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionName +The friendly name of the subscription. + +```yaml +Type: System.String +Parameter Sets: WorkloadCreateExpanded +Aliases: DisplayName + +Required: True Position: Named Default value: None Accept pipeline input: False @@ -194,7 +201,7 @@ Owner Id of the subscription ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: WorkloadCreateExpanded Aliases: Required: False @@ -209,7 +216,7 @@ Tenant Id of the subscription ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: WorkloadCreateExpanded Aliases: Required: False @@ -240,10 +247,10 @@ It can be either Production or DevTest. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload -Parameter Sets: (All) +Parameter Sets: WorkloadCreateExpanded Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -292,7 +299,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - ## RELATED LINKS diff --git a/src/Subscription/help/Remove-AzSubscriptionAlias.md b/src/Subscription/help/Remove-AzSubscriptionAlias.md index c47cc6815f33..82eb70ed7499 100644 --- a/src/Subscription/help/Remove-AzSubscriptionAlias.md +++ b/src/Subscription/help/Remove-AzSubscriptionAlias.md @@ -145,18 +145,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[AliasName ]`: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - - `[BillingAccountId ]`: Billing Account Id. - - `[Id ]`: Resource identity path - - `[SubscriptionId ]`: Subscription Id. - ## RELATED LINKS diff --git a/src/Subscription/help/Rename-AzSubscription.md b/src/Subscription/help/Rename-AzSubscription.md index c24a4648a1be..bf7baaf3ee85 100644 --- a/src/Subscription/help/Rename-AzSubscription.md +++ b/src/Subscription/help/Rename-AzSubscription.md @@ -14,13 +14,13 @@ The operation to rename a subscription ### RenameExpanded (Default) ``` -Rename-AzSubscription -Id [-SubscriptionName ] [-DefaultProfile ] [-Confirm] +Rename-AzSubscription -Id -SubscriptionName [-DefaultProfile ] [-Confirm] [-WhatIf] [] ``` ### RenameViaIdentityExpanded ``` -Rename-AzSubscription -InputObject [-SubscriptionName ] +Rename-AzSubscription -InputObject -SubscriptionName [-DefaultProfile ] [-Confirm] [-WhatIf] [] ``` @@ -95,9 +95,9 @@ New subscription name ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: DisplayName -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -148,18 +148,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[AliasName ]`: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - - `[BillingAccountId ]`: Billing Account Id. - - `[Id ]`: Resource identity path - - `[SubscriptionId ]`: Subscription Id. - ## RELATED LINKS diff --git a/src/Subscription/help/Update-AzSubscriptionPolicy.md b/src/Subscription/help/Update-AzSubscriptionPolicy.md deleted file mode 100644 index e1111a16e341..000000000000 --- a/src/Subscription/help/Update-AzSubscriptionPolicy.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -external help file: -Module Name: Az.Subscription -online version: https://learn.microsoft.com/powershell/module/az.subscription/update-azsubscriptionpolicy -schema: 2.0.0 ---- - -# Update-AzSubscriptionPolicy - -## SYNOPSIS -Create or Update Subscription tenant policy for user's tenant. - -## SYNTAX - -``` -Update-AzSubscriptionPolicy [-BlockSubscriptionsIntoTenant] [-BlockSubscriptionsLeavingTenant] - [-ExemptedPrincipal ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] -``` - -## DESCRIPTION -Create or Update Subscription tenant policy for user's tenant. - -## EXAMPLES - -### Example 1: Create or Update Subscription tenant policy for user's tenant. -```powershell -Update-AzSubscriptionPolicy -BlockSubscriptionsIntoTenant:$true -BlockSubscriptionsLeavingTenant:$false -ExemptedPrincipal XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -``` - -```output -Name PolicyId BlockSubscriptionsIntoTenant BlockSubscriptionsLeavingTenant ----- -------- ---------------------------- ------------------------------- -default XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX True False -``` - -Create or Update Subscription tenant policy for user's tenant. - -## PARAMETERS - -### -BlockSubscriptionsIntoTenant -Blocks the entering of subscriptions into user's tenant. - -```yaml -Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -BlockSubscriptionsLeavingTenant -Blocks the leaving of subscriptions from user's tenant. - -```yaml -Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -DefaultProfile -The DefaultProfile parameter is not functional. -Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. - -```yaml -Type: System.Management.Automation.PSObject -Parameter Sets: (All) -Aliases: AzureRMContext, AzureCredential - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -ExemptedPrincipal -List of user objectIds that are exempted from the set subscription tenant policies for the user's tenant. - -```yaml -Type: System.String[] -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Confirm -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -## OUTPUTS - -### Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse - -## NOTES - -ALIASES - -## RELATED LINKS - diff --git a/src/Subscription/internal/Get-AzSubscriptionAcceptOwnershipStatus.ps1 b/src/Subscription/internal/Get-AzSubscriptionAcceptOwnershipStatus.ps1 new file mode 100644 index 000000000000..fa733e52a387 --- /dev/null +++ b/src/Subscription/internal/Get-AzSubscriptionAcceptOwnershipStatus.ps1 @@ -0,0 +1,150 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Accept subscription ownership status. +.Description +Accept subscription ownership status. +.Example +Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. +.Link +https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionacceptownershipstatus +#> +function Get-AzSubscriptionAcceptOwnershipStatus { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse])] +[CmdletBinding(DefaultParameterSetName='AcceptExpanded', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='AcceptExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String[]] + # Subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='AcceptViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + AcceptExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptExpanded'; + AcceptViaIdentityExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/Subscription/internal/Get-AzSubscriptionOperation.ps1 b/src/Subscription/internal/Get-AzSubscriptionOperation.ps1 index c90805ae5fb8..934948a78496 100644 --- a/src/Subscription/internal/Get-AzSubscriptionOperation.ps1 +++ b/src/Subscription/internal/Get-AzSubscriptionOperation.ps1 @@ -16,23 +16,51 @@ <# .Synopsis -Lists all of the available Microsoft.Subscription API operations. +Get the status of the pending Microsoft.Subscription API operations. .Description -Lists all of the available Microsoft.Subscription API operations. +Get the status of the pending Microsoft.Subscription API operations. .Example {{ Add code here }} .Example {{ Add code here }} +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity .Outputs Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IOperation +.Outputs +System.String +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionoperation #> function Get-AzSubscriptionOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IOperation])] +[OutputType([System.String], [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IOperation])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # The operation ID, which can be found from the Location field in the generate recommendation response header. + ${OperationId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -62,6 +90,13 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='GetViaIdentity')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] [System.Uri] @@ -91,6 +126,8 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ + Get = 'Az.Subscription.private\Get-AzSubscriptionOperation_Get'; + GetViaIdentity = 'Az.Subscription.private\Get-AzSubscriptionOperation_GetViaIdentity'; List = 'Az.Subscription.private\Get-AzSubscriptionOperation_List'; } diff --git a/src/Subscription/internal/New-AzSubscriptionAlias.ps1 b/src/Subscription/internal/New-AzSubscriptionAlias.ps1 new file mode 100644 index 000000000000..27626376e879 --- /dev/null +++ b/src/Subscription/internal/New-AzSubscriptionAlias.ps1 @@ -0,0 +1,202 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create Alias Subscription. +.Description +Create Alias Subscription. +.Example +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +.Example +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse +.Link +https://learn.microsoft.com/powershell/module/az.subscription/new-azsubscriptionalias +#> +function New-AzSubscriptionAlias { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # AliasName is the name for the subscription creation request. + # Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + ${AliasName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Billing scope of the subscription.For CustomerLed and FieldLed - /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName}For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName} + ${BillingScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Management group Id for the subscription. + ${ManagementGroupId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Reseller Id + ${ResellerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # This parameter can be used to create alias for existing subscription Id + ${SubscriptionId}, + + [Parameter()] + [Alias('DisplayName')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # The friendly name of the subscription. + ${SubscriptionName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Owner Id of the subscription + ${SubscriptionOwnerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Tenant Id of the subscription + ${SubscriptionTenantId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IPutAliasRequestAdditionalPropertiesTags]))] + [System.Collections.Hashtable] + # Tags for the subscription + ${Tag}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload])] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload] + # The workload type of the subscription. + # It can be either Production or DevTest. + ${Workload}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.Subscription.private\New-AzSubscriptionAlias_CreateExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/Subscription/internal/ProxyCmdletDefinitions.ps1 b/src/Subscription/internal/ProxyCmdletDefinitions.ps1 index c90805ae5fb8..706b3f56429e 100644 --- a/src/Subscription/internal/ProxyCmdletDefinitions.ps1 +++ b/src/Subscription/internal/ProxyCmdletDefinitions.ps1 @@ -16,23 +16,186 @@ <# .Synopsis -Lists all of the available Microsoft.Subscription API operations. +Accept subscription ownership status. .Description -Lists all of the available Microsoft.Subscription API operations. +Accept subscription ownership status. +.Example +Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. +.Link +https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionacceptownershipstatus +#> +function Get-AzSubscriptionAcceptOwnershipStatus { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse])] +[CmdletBinding(DefaultParameterSetName='AcceptExpanded', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='AcceptExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String[]] + # Subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='AcceptViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + AcceptExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptExpanded'; + AcceptViaIdentityExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Get the status of the pending Microsoft.Subscription API operations. +.Description +Get the status of the pending Microsoft.Subscription API operations. .Example {{ Add code here }} .Example {{ Add code here }} +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity .Outputs Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IOperation +.Outputs +System.String +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. .Link https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscriptionoperation #> function Get-AzSubscriptionOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IOperation])] +[OutputType([System.String], [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IOperation])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # The operation ID, which can be found from the Location field in the generate recommendation response header. + ${OperationId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -62,6 +225,13 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='GetViaIdentity')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] [System.Uri] @@ -91,6 +261,8 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ + Get = 'Az.Subscription.private\Get-AzSubscriptionOperation_Get'; + GetViaIdentity = 'Az.Subscription.private\Get-AzSubscriptionOperation_GetViaIdentity'; List = 'Az.Subscription.private\Get-AzSubscriptionOperation_List'; } @@ -123,3 +295,461 @@ end { } } } + +<# +.Synopsis +Create Alias Subscription. +.Description +Create Alias Subscription. +.Example +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +.Example +New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse +.Link +https://learn.microsoft.com/powershell/module/az.subscription/new-azsubscriptionalias +#> +function New-AzSubscriptionAlias { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # AliasName is the name for the subscription creation request. + # Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + ${AliasName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Billing scope of the subscription.For CustomerLed and FieldLed - /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName}For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName} + ${BillingScope}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Management group Id for the subscription. + ${ManagementGroupId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Reseller Id + ${ResellerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # This parameter can be used to create alias for existing subscription Id + ${SubscriptionId}, + + [Parameter()] + [Alias('DisplayName')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # The friendly name of the subscription. + ${SubscriptionName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Owner Id of the subscription + ${SubscriptionOwnerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # Tenant Id of the subscription + ${SubscriptionTenantId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IPutAliasRequestAdditionalPropertiesTags]))] + [System.Collections.Hashtable] + # Tags for the subscription + ${Tag}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload])] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.Workload] + # The workload type of the subscription. + # It can be either Production or DevTest. + ${Workload}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.Subscription.private\New-AzSubscriptionAlias_CreateExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to rename a subscription +.Description +The operation to rename a subscription +.Example +Rename-AzSubscription -Id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -SubscriptionName test-subscription + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity +.Outputs +System.String +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. +.Link +https://learn.microsoft.com/powershell/module/az.subscription/rename-azsubscription +#> +function Rename-AzSubscription { +[OutputType([System.String])] +[CmdletBinding(DefaultParameterSetName='RenameExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RenameExpanded', Mandatory)] + [Alias('SubscriptionId')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # Subscription Id. + ${Id}, + + [Parameter(ParameterSetName='RenameViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # New subscription name + ${SubscriptionName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + RenameExpanded = 'Az.Subscription.private\Rename-AzSubscription_RenameExpanded'; + RenameViaIdentityExpanded = 'Az.Subscription.private\Rename-AzSubscription_RenameViaIdentityExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Create or Update Subscription tenant policy for user's tenant. +.Description +Create or Update Subscription tenant policy for user's tenant. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse +.Link +https://learn.microsoft.com/powershell/module/az.subscription/update-azsubscriptionpolicy +#> +function Update-AzSubscriptionPolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse])] +[CmdletBinding(DefaultParameterSetName='AddExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Blocks the entering of subscriptions into user's tenant. + ${BlockSubscriptionsIntoTenant}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Blocks the leaving of subscriptions from user's tenant. + ${BlockSubscriptionsLeavingTenant}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String[]] + # List of user objectIds that are exempted from the set subscription tenant policies for the user's tenant. + ${ExemptedPrincipal}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + AddExpanded = 'Az.Subscription.private\Update-AzSubscriptionPolicy_AddExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/Subscription/internal/Rename-AzSubscription.ps1 b/src/Subscription/internal/Rename-AzSubscription.ps1 new file mode 100644 index 000000000000..f6b5a5c28714 --- /dev/null +++ b/src/Subscription/internal/Rename-AzSubscription.ps1 @@ -0,0 +1,157 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to rename a subscription +.Description +The operation to rename a subscription +.Example +Rename-AzSubscription -Id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -SubscriptionName test-subscription + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity +.Outputs +System.String +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AliasName ]: AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + [BillingAccountId ]: Billing Account Id. + [Id ]: Resource identity path + [OperationId ]: The operation ID, which can be found from the Location field in the generate recommendation response header. + [SubscriptionId ]: Subscription Id. +.Link +https://learn.microsoft.com/powershell/module/az.subscription/rename-azsubscription +#> +function Rename-AzSubscription { +[OutputType([System.String])] +[CmdletBinding(DefaultParameterSetName='RenameExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RenameExpanded', Mandatory)] + [Alias('SubscriptionId')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [System.String] + # Subscription Id. + ${Id}, + + [Parameter(ParameterSetName='RenameViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')] + [System.String] + # New subscription name + ${SubscriptionName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + RenameExpanded = 'Az.Subscription.private\Rename-AzSubscription_RenameExpanded'; + RenameViaIdentityExpanded = 'Az.Subscription.private\Rename-AzSubscription_RenameViaIdentityExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/Subscription/exports/Update-AzSubscriptionPolicy.ps1 b/src/Subscription/internal/Update-AzSubscriptionPolicy.ps1 similarity index 64% rename from src/Subscription/exports/Update-AzSubscriptionPolicy.ps1 rename to src/Subscription/internal/Update-AzSubscriptionPolicy.ps1 index cb15ad9f22f9..ea5e08304715 100644 --- a/src/Subscription/exports/Update-AzSubscriptionPolicy.ps1 +++ b/src/Subscription/internal/Update-AzSubscriptionPolicy.ps1 @@ -20,7 +20,9 @@ Create or Update Subscription tenant policy for user's tenant. .Description Create or Update Subscription tenant policy for user's tenant. .Example -Update-AzSubscriptionPolicy -BlockSubscriptionsIntoTenant:$true -BlockSubscriptionsLeavingTenant:$false -ExemptedPrincipal XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +{{ Add code here }} +.Example +{{ Add code here }} .Outputs Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse @@ -107,34 +109,16 @@ begin { } $parameterSet = $PSCmdlet.ParameterSetName - if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { - [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() - } - $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId - if ($preTelemetryId -eq '') { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) - } else { - $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets - if ($internalCalledCmdlets -eq '') { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name - } else { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name - } - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' - } - $mapping = @{ AddExpanded = 'Az.Subscription.private\Update-AzSubscriptionPolicy_AddExpanded'; } - $cmdInfo = Get-Command -Name $mapping[$parameterSet] - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw } } @@ -143,14 +127,8 @@ process { try { $steppablePipeline.Process($_) } catch { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() - throw - } - finally { - $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId - $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw } } @@ -158,16 +136,8 @@ end { try { $steppablePipeline.End() - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets - if ($preTelemetryId -eq '') { - [Microsoft.Azure.PowerShell.Cmdlets.Subscription.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() - } - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId - } catch { - [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw } } diff --git a/src/Subscription/test/AzSubscription.Tests.ps1 b/src/Subscription/test/AzSubscription.Tests.ps1 index 31c357e33b7d..0d04a70862b8 100644 --- a/src/Subscription/test/AzSubscription.Tests.ps1 +++ b/src/Subscription/test/AzSubscription.Tests.ps1 @@ -48,7 +48,7 @@ Describe 'AzSubscription' { } | Should -Not -Throw } - It 'UpdateSubPolicy' { + It 'UpdateSubPolicy' -skip { { $config = Update-AzSubscriptionPolicy -BlockSubscriptionsIntoTenant:$false -BlockSubscriptionsLeavingTenant:$false $config.Count | Should -BeGreaterThan 0 diff --git a/src/Subscription/test/Get-AzSubscriptionPolicy.Tests.ps1 b/src/Subscription/test/Get-AzSubscriptionPolicy.Tests.ps1 index 0909b96ede14..3c024a8a9fed 100644 --- a/src/Subscription/test/Get-AzSubscriptionPolicy.Tests.ps1 +++ b/src/Subscription/test/Get-AzSubscriptionPolicy.Tests.ps1 @@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSubscriptionPolicy')) } Describe 'Get-AzSubscriptionPolicy' { - It 'Get' -skip { + It 'List' -skip { { throw [System.NotImplementedException] } | Should -Not -Throw } } diff --git a/src/Subscription/test/New-AzSubscriptionAlias.Tests.ps1 b/src/Subscription/test/New-AzSubscriptionAlias.Tests.ps1 index be0f4f1878e4..aaed34022b9c 100644 --- a/src/Subscription/test/New-AzSubscriptionAlias.Tests.ps1 +++ b/src/Subscription/test/New-AzSubscriptionAlias.Tests.ps1 @@ -18,4 +18,8 @@ Describe 'New-AzSubscriptionAlias' { It 'CreateExpanded' -skip { { throw [System.NotImplementedException] } | Should -Not -Throw } + + It 'WorkloadCreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } } diff --git a/src/Subscription/test/Update-AzSubscriptionPolicy.Tests.ps1 b/src/Subscription/test/Update-AzSubscriptionPolicy.Tests.ps1 deleted file mode 100644 index 04fa23ec5a76..000000000000 --- a/src/Subscription/test/Update-AzSubscriptionPolicy.Tests.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSubscriptionPolicy')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSubscriptionPolicy.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'Update-AzSubscriptionPolicy' { - It 'AddExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} From 93de2a2ccb02113eebf2a1c4c6655c7ea6cf9390 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Mon, 6 Nov 2023 20:32:53 +0800 Subject: [PATCH 2/2] Update ChangeLog.md --- src/Subscription/ChangeLog.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Subscription/ChangeLog.md b/src/Subscription/ChangeLog.md index 3c701f5d0c45..31ac03f594fc 100644 --- a/src/Subscription/ChangeLog.md +++ b/src/Subscription/ChangeLog.md @@ -18,6 +18,16 @@ - Additional information about change #1 --> ## Upcoming Release +* Invoke-AzSubscriptionAcceptOwnership: + - Added alias `-DisplayName` to parameter `-SubscriptionName`. +* New-AzSubscriptionAlias: + - Added alias `-DisplayName` to parameter `-SubscriptionName`. +* Rename-AzSubscription: + - Changed parameter `-SubscriptionName` to required. + - Added alias `-DisplayName` to parameter `-SubscriptionName`. +* Removed cmdlet `Update-AzSubscriptionPolicy` +* Get-AzSubscriptionAcceptOwnershipStatus + - Updated parameter type of `SubscriptionId` from `string[]` to `string`. ## Version 0.10.1 * Removed the default value for the `New-AzSubscriptionAlias` cmdlet parameter `SubscriptionId`.