|
| 1 | + |
| 2 | +# ---------------------------------------------------------------------------------- |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# Unless required by applicable law or agreed to in writing, software |
| 9 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +# See the License for the specific language governing permissions and |
| 12 | +# limitations under the License. |
| 13 | +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code |
| 14 | +# is regenerated. |
| 15 | +# ---------------------------------------------------------------------------------- |
| 16 | + |
| 17 | +<# |
| 18 | +.Synopsis |
| 19 | +Create a OrganizationResource |
| 20 | +.Description |
| 21 | +Create a OrganizationResource |
| 22 | +.Example |
| 23 | +New-AzAstroOrganization -Name UT.7.test -ResourceGroupName astro-user -Location eastus -MarketplaceSubscriptionId 11111111-2222-3333-4444-123456789101 -OfferDetailOfferId astro -OfferDetailPlanId astro-paygo -OfferDetailPublisherId astronomer1 -OfferDetailPlanName 'Monthly Pay-As-You-Go' -OfferDetailTermId abcdefghijkl -OfferDetailTermUnit Monthly -UserEmailAddress [email protected] -UserFirstName user -UserLastName test -UserUpn [email protected] -PartnerOrganizationPropertyWorkspaceName aaa -PartnerOrganizationPropertyOrganizationName bbb -SingleSignOnPropertyAadDomain MicrosoftCustomerLed.onmicrosoft.com |
| 24 | +
|
| 25 | +.Outputs |
| 26 | +Microsoft.Azure.PowerShell.Cmdlets.Astro.Models.IOrganizationResource |
| 27 | +.Link |
| 28 | +https://learn.microsoft.com/powershell/module/az.astro/new-azastroorganization |
| 29 | +#> |
| 30 | +function New-AzAstroOrganization { |
| 31 | + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Astro.Models.IOrganizationResource])] |
| 32 | + [CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] |
| 33 | + param( |
| 34 | + [Parameter(Mandatory)] |
| 35 | + [Alias('OrganizationName')] |
| 36 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Path')] |
| 37 | + [System.String] |
| 38 | + # Name of the Organizations resource |
| 39 | + ${Name}, |
| 40 | + |
| 41 | + [Parameter(Mandatory)] |
| 42 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Path')] |
| 43 | + [System.String] |
| 44 | + # The name of the resource group. |
| 45 | + # The name is case insensitive. |
| 46 | + ${ResourceGroupName}, |
| 47 | + |
| 48 | + [Parameter()] |
| 49 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Path')] |
| 50 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] |
| 51 | + [System.String] |
| 52 | + # The ID of the target subscription. |
| 53 | + ${SubscriptionId}, |
| 54 | + |
| 55 | + [Parameter(ParameterSetName = 'CreateExpanded', Mandatory)] |
| 56 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 57 | + [System.String] |
| 58 | + # The geo-location where the resource lives |
| 59 | + ${Location}, |
| 60 | + |
| 61 | + [Parameter(ParameterSetName = 'CreateExpanded', Mandatory)] |
| 62 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 63 | + [System.String] |
| 64 | + # Azure subscription id for the the marketplace offer is purchased from |
| 65 | + ${MarketplaceSubscriptionId}, |
| 66 | + |
| 67 | + [Parameter(ParameterSetName = 'CreateExpanded', Mandatory)] |
| 68 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 69 | + [System.String] |
| 70 | + # Offer Id for the marketplace offer |
| 71 | + ${OfferDetailOfferId}, |
| 72 | + |
| 73 | + [Parameter(ParameterSetName = 'CreateExpanded', Mandatory)] |
| 74 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 75 | + [System.String] |
| 76 | + # Plan Id for the marketplace offer |
| 77 | + ${OfferDetailPlanId}, |
| 78 | + |
| 79 | + [Parameter(ParameterSetName = 'CreateExpanded', Mandatory)] |
| 80 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 81 | + [System.String] |
| 82 | + # Publisher Id for the marketplace offer |
| 83 | + ${OfferDetailPublisherId}, |
| 84 | + |
| 85 | + [Parameter(ParameterSetName = 'CreateExpanded', Mandatory)] |
| 86 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 87 | + [System.String] |
| 88 | + # Email address of the user |
| 89 | + ${UserEmailAddress}, |
| 90 | + |
| 91 | + [Parameter(ParameterSetName = 'CreateExpanded', Mandatory)] |
| 92 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 93 | + [System.String] |
| 94 | + # First name of the user |
| 95 | + ${UserFirstName}, |
| 96 | + |
| 97 | + [Parameter(ParameterSetName = 'CreateExpanded', Mandatory)] |
| 98 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 99 | + [System.String] |
| 100 | + # Last name of the user |
| 101 | + ${UserLastName}, |
| 102 | + |
| 103 | + [Parameter(ParameterSetName='CreateExpanded')] |
| 104 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 105 | + [System.Management.Automation.SwitchParameter] |
| 106 | + # Decides if enable a system assigned identity for the resource. |
| 107 | + ${EnableSystemAssignedIdentity}, |
| 108 | + |
| 109 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 110 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.PSArgumentCompleterAttribute("PendingFulfillmentStart", "Subscribed", "Suspended", "Unsubscribed")] |
| 111 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 112 | + [System.String] |
| 113 | + # Marketplace subscription status |
| 114 | + ${MarketplaceSubscriptionStatus}, |
| 115 | + |
| 116 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 117 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 118 | + [System.String] |
| 119 | + # Plan Name for the marketplace offer |
| 120 | + ${OfferDetailPlanName}, |
| 121 | + |
| 122 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 123 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 124 | + [System.String] |
| 125 | + # Plan Display Name for the marketplace offer |
| 126 | + ${OfferDetailTermId}, |
| 127 | + |
| 128 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 129 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 130 | + [System.String] |
| 131 | + # Plan Display Name for the marketplace offer |
| 132 | + ${OfferDetailTermUnit}, |
| 133 | + |
| 134 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 135 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 136 | + [System.String] |
| 137 | + # Organization Id in partner's system |
| 138 | + ${PartnerOrganizationPropertyOrganizationId}, |
| 139 | + |
| 140 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 141 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 142 | + [System.String] |
| 143 | + # Organization name in partner's system |
| 144 | + ${PartnerOrganizationPropertyOrganizationName}, |
| 145 | + |
| 146 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 147 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 148 | + [System.String] |
| 149 | + # Workspace Id in partner's system |
| 150 | + ${PartnerOrganizationPropertyWorkspaceId}, |
| 151 | + |
| 152 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 153 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 154 | + [System.String] |
| 155 | + # Workspace name in partner's system |
| 156 | + ${PartnerOrganizationPropertyWorkspaceName}, |
| 157 | + |
| 158 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 159 | + [AllowEmptyCollection()] |
| 160 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 161 | + [System.String[]] |
| 162 | + # List of AAD domains fetched from Microsoft Graph for user. |
| 163 | + ${SingleSignOnPropertyAadDomain}, |
| 164 | + |
| 165 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 166 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 167 | + [System.String] |
| 168 | + # AAD enterprise application Id used to setup SSO |
| 169 | + ${SingleSignOnPropertyEnterpriseAppId}, |
| 170 | + |
| 171 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 172 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.PSArgumentCompleterAttribute("Initial", "Enable", "Disable")] |
| 173 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 174 | + [System.String] |
| 175 | + # State of the Single Sign On for the organization |
| 176 | + ${SingleSignOnPropertySingleSignOnState}, |
| 177 | + |
| 178 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 179 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 180 | + [System.String] |
| 181 | + # URL for SSO to be used by the partner to redirect the user to their system |
| 182 | + ${SingleSignOnPropertySingleSignOnUrl}, |
| 183 | + |
| 184 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 185 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 186 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.Astro.Models.ITrackedResourceTags]))] |
| 187 | + [System.Collections.Hashtable] |
| 188 | + # Resource tags. |
| 189 | + ${Tag}, |
| 190 | + |
| 191 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 192 | + [AllowEmptyCollection()] |
| 193 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 194 | + [System.String[]] |
| 195 | + # The array of user assigned identities associated with the resource. |
| 196 | + # The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.' |
| 197 | + ${UserAssignedIdentity}, |
| 198 | + |
| 199 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 200 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 201 | + [System.String] |
| 202 | + # User's phone number |
| 203 | + ${UserPhoneNumber}, |
| 204 | + |
| 205 | + [Parameter(ParameterSetName = 'CreateExpanded')] |
| 206 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 207 | + [System.String] |
| 208 | + # User's principal name |
| 209 | + ${UserUpn}, |
| 210 | + |
| 211 | + [Parameter(ParameterSetName = 'CreateViaJsonFilePath', Mandatory)] |
| 212 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 213 | + [System.String] |
| 214 | + # Path of Json file supplied to the Create operation |
| 215 | + ${JsonFilePath}, |
| 216 | + |
| 217 | + [Parameter(ParameterSetName = 'CreateViaJsonString', Mandatory)] |
| 218 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')] |
| 219 | + [System.String] |
| 220 | + # Json string supplied to the Create operation |
| 221 | + ${JsonString}, |
| 222 | + |
| 223 | + [Parameter()] |
| 224 | + [Alias('AzureRMContext', 'AzureCredential')] |
| 225 | + [ValidateNotNull()] |
| 226 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Azure')] |
| 227 | + [System.Management.Automation.PSObject] |
| 228 | + # The DefaultProfile parameter is not functional. |
| 229 | + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. |
| 230 | + ${DefaultProfile}, |
| 231 | + |
| 232 | + [Parameter()] |
| 233 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')] |
| 234 | + [System.Management.Automation.SwitchParameter] |
| 235 | + # Run the command as a job |
| 236 | + ${AsJob}, |
| 237 | + |
| 238 | + [Parameter(DontShow)] |
| 239 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')] |
| 240 | + [System.Management.Automation.SwitchParameter] |
| 241 | + # Wait for .NET debugger to attach |
| 242 | + ${Break}, |
| 243 | + |
| 244 | + [Parameter(DontShow)] |
| 245 | + [ValidateNotNull()] |
| 246 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')] |
| 247 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Runtime.SendAsyncStep[]] |
| 248 | + # SendAsync Pipeline Steps to be appended to the front of the pipeline |
| 249 | + ${HttpPipelineAppend}, |
| 250 | + |
| 251 | + [Parameter(DontShow)] |
| 252 | + [ValidateNotNull()] |
| 253 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')] |
| 254 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Runtime.SendAsyncStep[]] |
| 255 | + # SendAsync Pipeline Steps to be prepended to the front of the pipeline |
| 256 | + ${HttpPipelinePrepend}, |
| 257 | + |
| 258 | + [Parameter()] |
| 259 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')] |
| 260 | + [System.Management.Automation.SwitchParameter] |
| 261 | + # Run the command asynchronously |
| 262 | + ${NoWait}, |
| 263 | + |
| 264 | + [Parameter(DontShow)] |
| 265 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')] |
| 266 | + [System.Uri] |
| 267 | + # The URI for the proxy server to use |
| 268 | + ${Proxy}, |
| 269 | + |
| 270 | + [Parameter(DontShow)] |
| 271 | + [ValidateNotNull()] |
| 272 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')] |
| 273 | + [System.Management.Automation.PSCredential] |
| 274 | + # Credentials for a proxy server to use for the remote call |
| 275 | + ${ProxyCredential}, |
| 276 | + |
| 277 | + [Parameter(DontShow)] |
| 278 | + [Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')] |
| 279 | + [System.Management.Automation.SwitchParameter] |
| 280 | + # Use the default credentials for the proxy |
| 281 | + ${ProxyUseDefaultCredentials} |
| 282 | + ) |
| 283 | + |
| 284 | + process { |
| 285 | + if($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity') -or $PSBoundParameters.ContainsKey('UserAssignedIdentity') ){ |
| 286 | + $supportsSystemAssignedIdentity = $PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity') |
| 287 | + $supportsUserAssignedIdentity = $PSBoundParameters.ContainsKey("UserAssignedIdentity") -and $UserAssignedIdentity.Length -gt 0 |
| 288 | + |
| 289 | + # calculate IdentityType |
| 290 | + if (($supportsSystemAssignedIdentity -and $supportsUserAssignedIdentity)) { |
| 291 | + $PSBoundParameters.Add("IdentityType", "SystemAssigned,UserAssigned") |
| 292 | + } |
| 293 | + elseif ($supportsUserAssignedIdentity -and (-not $supportsSystemAssignedIdentity)) { |
| 294 | + $PSBoundParameters.Add("IdentityType", "UserAssigned") |
| 295 | + } |
| 296 | + elseif ((-not $supportsUserAssignedIdentity) -and $supportsSystemAssignedIdentity) { |
| 297 | + $PSBoundParameters.Add("IdentityType", "SystemAssigned") |
| 298 | + } |
| 299 | + else { |
| 300 | + $PSBoundParameters.Add("IdentityType", "None") |
| 301 | + } |
| 302 | + |
| 303 | + # remove EnableSystemAssignedIdentity |
| 304 | + if($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')) { |
| 305 | + $null = $PSBoundParameters.Remove("EnableSystemAssignedIdentity") |
| 306 | + } |
| 307 | + } |
| 308 | + Az.Astro.internal\New-AzAstroOrganization @PSBoundParameters |
| 309 | + } |
| 310 | + |
| 311 | +} |
0 commit comments