|
| 1 | +<# |
| 2 | +.Synopsis |
| 3 | +Creates or updates the specified subscription. |
| 4 | +.Description |
| 5 | +Creates or updates the specified subscription. |
| 6 | +.Example |
| 7 | +To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/azs.subscriptions.admin/new-azsusersubscription |
| 8 | +.Inputs |
| 9 | +Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Models.Api20151101.ISubscriptionDefinition |
| 10 | +.Outputs |
| 11 | +Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Models.Api20151101.ISubscriptionDefinition |
| 12 | +.Notes |
| 13 | +COMPLEX PARAMETER PROPERTIES |
| 14 | +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. |
| 15 | +
|
| 16 | +SUBSCRIPTIONDEFINITION <ISubscriptionDefinition>: Subscription object properties. |
| 17 | + [DelegatedProviderSubscriptionId <String>]: Parent DelegatedProvider subscription identifier. |
| 18 | + [DisplayName <String>]: Subscription name. |
| 19 | + [ExternalReferenceId <String>]: External reference identifier. |
| 20 | + [Id <String>]: Fully qualified identifier. |
| 21 | + [OfferId <String>]: Identifier of the offer under the scope of a delegated provider. |
| 22 | + [Owner <String>]: Subscription owner. |
| 23 | + [RoutingResourceManagerType <ResourceManagerType?>]: Routing resource manager type. |
| 24 | + [State <SubscriptionState?>]: Subscription state. |
| 25 | + [SubscriptionId <String>]: Subscription identifier. |
| 26 | + [TenantId <String>]: Directory tenant identifier. |
| 27 | +.Link |
| 28 | +https://docs.microsoft.com/en-us/powershell/module/azs.subscriptions.admin/new-azsusersubscription |
| 29 | +#> |
| 30 | +function New-AzsUserSubscription { |
| 31 | +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Models.Api20151101.ISubscriptionDefinition])] |
| 32 | +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] |
| 33 | +param( |
| 34 | + [Parameter()] |
| 35 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Path')] |
| 36 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Runtime.DefaultInfo(Script='$([Guid]::NewGuid().ToString())')] |
| 37 | + [System.String] |
| 38 | + # The target subscription ID. |
| 39 | + ${TargetSubscriptionId}, |
| 40 | + |
| 41 | + [Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)] |
| 42 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 43 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Models.Api20151101.ISubscriptionDefinition] |
| 44 | + # Subscription object properties. |
| 45 | + # To construct, see NOTES section for SUBSCRIPTIONDEFINITION properties and create a hash table. |
| 46 | + ${SubscriptionDefinition}, |
| 47 | + |
| 48 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 49 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 50 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] |
| 51 | + [System.String] |
| 52 | + # Parent DelegatedProvider subscription identifier. |
| 53 | + ${DelegatedProviderSubscriptionId}, |
| 54 | + |
| 55 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 56 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 57 | + [System.String] |
| 58 | + # Subscription name. |
| 59 | + ${DisplayName}, |
| 60 | + |
| 61 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 62 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 63 | + [System.String] |
| 64 | + # External reference identifier. |
| 65 | + ${ExternalReferenceId}, |
| 66 | + |
| 67 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 68 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 69 | + [System.String] |
| 70 | + # Fully qualified identifier. |
| 71 | + ${Id}, |
| 72 | + |
| 73 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 74 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 75 | + [System.String] |
| 76 | + # Identifier of the offer under the scope of a delegated provider. |
| 77 | + ${OfferId}, |
| 78 | + |
| 79 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 80 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 81 | + [System.String] |
| 82 | + # Subscription owner. |
| 83 | + ${Owner}, |
| 84 | + |
| 85 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 86 | + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Support.ResourceManagerType])] |
| 87 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 88 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Runtime.DefaultInfo(Script='Write-Output "Default"')] |
| 89 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Support.ResourceManagerType] |
| 90 | + # Routing resource manager type. |
| 91 | + ${RoutingResourceManagerType}, |
| 92 | + |
| 93 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 94 | + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Support.SubscriptionState])] |
| 95 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 96 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Runtime.DefaultInfo(Script='Write-Output "Enabled"')] |
| 97 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Support.SubscriptionState] |
| 98 | + # Subscription state. |
| 99 | + ${State}, |
| 100 | + |
| 101 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 102 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Body')] |
| 103 | + [System.String] |
| 104 | + # Directory tenant identifier. |
| 105 | + ${TenantId}, |
| 106 | + |
| 107 | + [Parameter()] |
| 108 | + [Alias('AzureRMContext', 'AzureCredential')] |
| 109 | + [ValidateNotNull()] |
| 110 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Azure')] |
| 111 | + [System.Management.Automation.PSObject] |
| 112 | + # The credentials, account, tenant, and subscription used for communication with Azure. |
| 113 | + ${DefaultProfile}, |
| 114 | + |
| 115 | + [Parameter(DontShow)] |
| 116 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Runtime')] |
| 117 | + [System.Management.Automation.SwitchParameter] |
| 118 | + # Wait for .NET debugger to attach |
| 119 | + ${Break}, |
| 120 | + |
| 121 | + [Parameter(DontShow)] |
| 122 | + [ValidateNotNull()] |
| 123 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Runtime')] |
| 124 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Runtime.SendAsyncStep[]] |
| 125 | + # SendAsync Pipeline Steps to be appended to the front of the pipeline |
| 126 | + ${HttpPipelineAppend}, |
| 127 | + |
| 128 | + [Parameter(DontShow)] |
| 129 | + [ValidateNotNull()] |
| 130 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Runtime')] |
| 131 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Runtime.SendAsyncStep[]] |
| 132 | + # SendAsync Pipeline Steps to be prepended to the front of the pipeline |
| 133 | + ${HttpPipelinePrepend}, |
| 134 | + |
| 135 | + [Parameter(DontShow)] |
| 136 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Runtime')] |
| 137 | + [System.Uri] |
| 138 | + # The URI for the proxy server to use |
| 139 | + ${Proxy}, |
| 140 | + |
| 141 | + [Parameter(DontShow)] |
| 142 | + [ValidateNotNull()] |
| 143 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Runtime')] |
| 144 | + [System.Management.Automation.PSCredential] |
| 145 | + # Credentials for a proxy server to use for the remote call |
| 146 | + ${ProxyCredential}, |
| 147 | + |
| 148 | + [Parameter(DontShow)] |
| 149 | + [Microsoft.Azure.PowerShell.Cmdlets.SubscriptionsAdmin.Category('Runtime')] |
| 150 | + [System.Management.Automation.SwitchParameter] |
| 151 | + # Use the default credentials for the proxy |
| 152 | + ${ProxyUseDefaultCredentials} |
| 153 | +) |
| 154 | + |
| 155 | + process { |
| 156 | + if ( $PSCmdlet.ParameterSetName -eq 'CreateExpanded' ) |
| 157 | + { |
| 158 | + # SubscriptionId and DelegatedProviderSubscriptionId are duplicate parameters generated by autorest. |
| 159 | + # Set DelegatedProviderSubscriptionId as SubscriptionId |
| 160 | + if ($null -ne $PSBoundParameters['TargetSubscriptionId']) |
| 161 | + { |
| 162 | + $PSBoundParameters['SubscriptionId1'] = $PSBoundParameters['TargetSubscriptionId'] |
| 163 | + } |
| 164 | + } |
| 165 | + Azs.Subscriptions.Admin.internal\New-AzsUserSubscription @PSBoundParameters |
| 166 | + } |
| 167 | + |
| 168 | +} |
0 commit comments