16
16
17
17
<#
18
18
. Synopsis
19
- Create a new CommunicationService or update an existing CommunicationService.
19
+ create a new CommunicationService or create an existing CommunicationService.
20
20
. Description
21
- Create a new CommunicationService or update an existing CommunicationService.
21
+ create a new CommunicationService or create an existing CommunicationService.
22
22
. Example
23
23
New-AzCommunicationService -ResourceGroupName ContosoResourceProvider1 -Name ContosoAcsResource1 -DataLocation UnitedStates -Location Global
24
24
. Example
25
25
$linkedDomains = @(
26
26
"/subscriptions/653983b8-683a-427c-8c27-9e9624ce9176/resourceGroups/tcsacstest/providers/Microsoft.Communication/emailServices/tcsacstestECSps/domains/AzureManagedDomain"
27
27
)
28
28
29
- New-AzCommunicationService -ResourceGroupName ContosoResourceProvider -Name ContosoAcsResource2 -DataLocation UnitedStates -Location Global -LinkedDomain @linkedDomains
29
+ New-AzCommunicationService -ResourceGroupName ContosoResourceProvider -Name ContosoAcsResource2 -DataLocation UnitedStates -Location Global -LinkedDomain @linkedDomains
30
30
31
31
. Outputs
32
- Microsoft.Azure.PowerShell.Cmdlets.Communication.Models.Api20230601Preview. ICommunicationServiceResource
32
+ Microsoft.Azure.PowerShell.Cmdlets.Communication.Models.ICommunicationServiceResource
33
33
. Link
34
34
https://learn.microsoft.com/powershell/module/az.communication/new-azcommunicationservice
35
35
#>
36
36
function New-AzCommunicationService {
37
- [OutputType ([Microsoft.Azure.PowerShell.Cmdlets.Communication.Models.Api20230601Preview. ICommunicationServiceResource ])]
37
+ [OutputType ([Microsoft.Azure.PowerShell.Cmdlets.Communication.Models.ICommunicationServiceResource ])]
38
38
[CmdletBinding (DefaultParameterSetName = ' CreateExpanded' , PositionalBinding = $false , SupportsShouldProcess , ConfirmImpact = ' Medium' )]
39
39
param (
40
40
[Parameter (Mandatory )]
@@ -59,48 +59,58 @@ param(
59
59
# The value must be an UUID.
60
60
${SubscriptionId} ,
61
61
62
- [Parameter (Mandatory )]
62
+ [Parameter (ParameterSetName = ' CreateExpanded ' , Mandatory )]
63
63
[Microsoft.Azure.PowerShell.Cmdlets.Communication.Category (' Body' )]
64
64
[System.String ]
65
65
# The geo-location where the resource lives
66
66
${Location} ,
67
67
68
- [Parameter ()]
68
+ [Parameter (ParameterSetName = ' CreateExpanded ' )]
69
69
[Microsoft.Azure.PowerShell.Cmdlets.Communication.Category (' Body' )]
70
70
[System.String ]
71
71
# The location where the communication service stores its data at rest.
72
72
${DataLocation} ,
73
73
74
- [Parameter ()]
75
- [ArgumentCompleter ([Microsoft.Azure.PowerShell.Cmdlets.Communication.Support.ManagedServiceIdentityType ])]
76
- [Microsoft.Azure.PowerShell.Cmdlets.Communication.Category (' Body' )]
77
- [Microsoft.Azure.PowerShell.Cmdlets.Communication.Support.ManagedServiceIdentityType ]
78
- # Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
79
- ${IdentityType} ,
80
-
81
- [Parameter ()]
74
+ [Parameter (ParameterSetName = ' CreateExpanded' )]
82
75
[Microsoft.Azure.PowerShell.Cmdlets.Communication.Category (' Body' )]
83
- [Microsoft.Azure.PowerShell.Cmdlets.Communication.Runtime.Info (PossibleTypes= ([Microsoft.Azure.PowerShell.Cmdlets.Communication.Models.Api50.IUserAssignedIdentities ]))]
84
- [System.Collections.Hashtable ]
85
- # The set of user assigned identities associated with the resource.
86
- # The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.
87
- # The dictionary values can be empty objects ({}) in requests.
88
- ${IdentityUserAssignedIdentity} ,
76
+ [System.Management.Automation.SwitchParameter ]
77
+ # Determines whether to enable a system-assigned identity for the resource.
78
+ ${EnableSystemAssignedIdentity} ,
89
79
90
- [Parameter ()]
80
+ [Parameter (ParameterSetName = ' CreateExpanded ' )]
91
81
[AllowEmptyCollection ()]
92
82
[Microsoft.Azure.PowerShell.Cmdlets.Communication.Category (' Body' )]
93
83
[System.String []]
94
84
# List of email Domain resource Ids.
95
85
${LinkedDomain} ,
96
86
97
- [Parameter ()]
87
+ [Parameter (ParameterSetName = ' CreateExpanded ' )]
98
88
[Microsoft.Azure.PowerShell.Cmdlets.Communication.Category (' Body' )]
99
- [Microsoft.Azure.PowerShell.Cmdlets.Communication.Runtime.Info (PossibleTypes= ([Microsoft.Azure.PowerShell.Cmdlets.Communication.Models.Api40. ITrackedResourceTags ]))]
89
+ [Microsoft.Azure.PowerShell.Cmdlets.Communication.Runtime.Info (PossibleTypes= ([Microsoft.Azure.PowerShell.Cmdlets.Communication.Models.ITrackedResourceTags ]))]
100
90
[System.Collections.Hashtable ]
101
91
# Resource tags.
102
92
${Tag} ,
103
93
94
+ [Parameter (ParameterSetName = ' CreateExpanded' )]
95
+ [AllowEmptyCollection ()]
96
+ [Microsoft.Azure.PowerShell.Cmdlets.Communication.Category (' Body' )]
97
+ [System.String []]
98
+ # The array of user assigned identities associated with the resource.
99
+ # The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.'
100
+ ${UserAssignedIdentity} ,
101
+
102
+ [Parameter (ParameterSetName = ' CreateViaJsonFilePath' , Mandatory )]
103
+ [Microsoft.Azure.PowerShell.Cmdlets.Communication.Category (' Body' )]
104
+ [System.String ]
105
+ # Path of Json file supplied to the Create operation
106
+ ${JsonFilePath} ,
107
+
108
+ [Parameter (ParameterSetName = ' CreateViaJsonString' , Mandatory )]
109
+ [Microsoft.Azure.PowerShell.Cmdlets.Communication.Category (' Body' )]
110
+ [System.String ]
111
+ # Json string supplied to the Create operation
112
+ ${JsonString} ,
113
+
104
114
[Parameter ()]
105
115
[Alias (' AzureRMContext' , ' AzureCredential' )]
106
116
[ValidateNotNull ()]
@@ -169,6 +179,15 @@ begin {
169
179
$PSBoundParameters [' OutBuffer' ] = 1
170
180
}
171
181
$parameterSet = $PSCmdlet.ParameterSetName
182
+
183
+ $testPlayback = $false
184
+ $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Communication.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
185
+
186
+ $context = Get-AzContext
187
+ if (-not $context -and -not $testPlayback ) {
188
+ Write-Error " No Azure login detected. Please run 'Connect-AzAccount' to log in."
189
+ exit
190
+ }
172
191
173
192
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion) {
174
193
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PowerShellVersion = $PSVersionTable.PSVersion.ToString ()
@@ -189,10 +208,10 @@ begin {
189
208
190
209
$mapping = @ {
191
210
CreateExpanded = ' Az.Communication.private\New-AzCommunicationService_CreateExpanded' ;
211
+ CreateViaJsonFilePath = ' Az.Communication.private\New-AzCommunicationService_CreateViaJsonFilePath' ;
212
+ CreateViaJsonString = ' Az.Communication.private\New-AzCommunicationService_CreateViaJsonString' ;
192
213
}
193
- if ((' CreateExpanded' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' )) {
194
- $testPlayback = $false
195
- $PSBoundParameters [' HttpPipelinePrepend' ] | Foreach-Object { if ($_ ) { $testPlayback = $testPlayback -or (' Microsoft.Azure.PowerShell.Cmdlets.Communication.Runtime.PipelineMock' -eq $_.Target.GetType ().FullName -and ' Playback' -eq $_.Target.Mode ) } }
214
+ if ((' CreateExpanded' , ' CreateViaJsonFilePath' , ' CreateViaJsonString' ) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey (' SubscriptionId' ) ) {
196
215
if ($testPlayback ) {
197
216
$PSBoundParameters [' SubscriptionId' ] = . (Join-Path $PSScriptRoot ' ..' ' utils' ' Get-SubscriptionIdTestSafe.ps1' )
198
217
} else {
@@ -206,6 +225,9 @@ begin {
206
225
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet ]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name )
207
226
}
208
227
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand (($mapping [$parameterSet ]), [System.Management.Automation.CommandTypes ]::Cmdlet)
228
+ if ($wrappedCmd -eq $null ) {
229
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand (($mapping [$parameterSet ]), [System.Management.Automation.CommandTypes ]::Function)
230
+ }
209
231
$scriptCmd = {& $wrappedCmd @PSBoundParameters }
210
232
$steppablePipeline = $scriptCmd.GetSteppablePipeline ($MyInvocation.CommandOrigin )
211
233
$steppablePipeline.Begin ($PSCmdlet )
0 commit comments