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
+ function Set-AzVmssVMRunCommand_ScriptLocalPath {
18
+ [OutputType ([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IVirtualMachineRunCommand ])]
19
+ [CmdletBinding (DefaultParameterSetName = ' UpdateExpanded' , PositionalBinding = $false , SupportsShouldProcess , ConfirmImpact = ' Medium' )]
20
+ param (
21
+ [Parameter (Mandatory )]
22
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Path' )]
23
+ [System.String ]
24
+ # The instance ID of the virtual machine.
25
+ ${InstanceId} ,
26
+
27
+ [Parameter (Mandatory )]
28
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Path' )]
29
+ [System.String ]
30
+ # The name of the resource group.
31
+ ${ResourceGroupName} ,
32
+
33
+ [Parameter (Mandatory )]
34
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Path' )]
35
+ [System.String ]
36
+ # The name of the virtual machine run command.
37
+ ${RunCommandName} ,
38
+
39
+ [Parameter (Mandatory )]
40
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Path' )]
41
+ [System.String ]
42
+ # The name of the VM scale set.
43
+ ${VMScaleSetName} ,
44
+
45
+ [Parameter (Mandatory )]
46
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
47
+ [System.String ]
48
+ # Specifies a commandId of predefined built-in script.
49
+ ${ScriptLocalPath} ,
50
+
51
+ [Parameter ()]
52
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Path' )]
53
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.DefaultInfo (Script= ' (Get-AzContext).Subscription.Id' )]
54
+ [System.String ]
55
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
56
+ # The subscription ID forms part of the URI for every service call.
57
+ ${SubscriptionId} ,
58
+
59
+ [Parameter (Mandatory )]
60
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
61
+ [System.String ]
62
+ # Resource location
63
+ ${Location} ,
64
+
65
+ [Parameter ()]
66
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
67
+ [System.Management.Automation.SwitchParameter ]
68
+ # Optional.
69
+ # If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete.
70
+ ${AsyncExecution} ,
71
+
72
+ [Parameter ()]
73
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
74
+ [System.String ]
75
+ # Specifies the Azure storage blob where script error stream will be uploaded.
76
+ ${ErrorBlobUri} ,
77
+
78
+ [Parameter ()]
79
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
80
+ [System.String ]
81
+ # Specifies the Azure storage blob where script output stream will be uploaded.
82
+ ${OutputBlobUri} ,
83
+
84
+ [Parameter ()]
85
+ [AllowEmptyCollection ()]
86
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
87
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IRunCommandInputParameter []]
88
+ # The parameters used by the script.
89
+ # To construct, see NOTES section for PARAMETER properties and create a hash table.
90
+ ${Parameter} ,
91
+
92
+ [Parameter ()]
93
+ [AllowEmptyCollection ()]
94
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
95
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IRunCommandInputParameter []]
96
+ # The parameters used by the script.
97
+ # To construct, see NOTES section for PROTECTEDPARAMETER properties and create a hash table.
98
+ ${ProtectedParameter} ,
99
+
100
+ [Parameter ()]
101
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
102
+ [System.String ]
103
+ # Specifies the user account password on the VM when executing the run command.
104
+ ${RunAsPassword} ,
105
+
106
+ [Parameter ()]
107
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
108
+ [System.String ]
109
+ # Specifies the user account on the VM when executing the run command.
110
+ ${RunAsUser} ,
111
+
112
+ [Parameter ()]
113
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
114
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Info (PossibleTypes= ([Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IResourceTags ]))]
115
+ [System.Collections.Hashtable ]
116
+ # Resource tags
117
+ ${Tag} ,
118
+
119
+ [Parameter ()]
120
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Body' )]
121
+ [System.Int32 ]
122
+ # The timeout in seconds to execute the run command.
123
+ ${TimeoutInSecond} ,
124
+
125
+ [Parameter ()]
126
+ [Alias (' AzureRMContext' , ' AzureCredential' )]
127
+ [ValidateNotNull ()]
128
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Azure' )]
129
+ [System.Management.Automation.PSObject ]
130
+ # The credentials, account, tenant, and subscription used for communication with Azure.
131
+ ${DefaultProfile} ,
132
+
133
+ [Parameter ()]
134
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Runtime' )]
135
+ [System.Management.Automation.SwitchParameter ]
136
+ # Run the command as a job
137
+ ${AsJob} ,
138
+
139
+ [Parameter (DontShow)]
140
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Runtime' )]
141
+ [System.Management.Automation.SwitchParameter ]
142
+ # Wait for .NET debugger to attach
143
+ ${Break} ,
144
+
145
+ [Parameter (DontShow)]
146
+ [ValidateNotNull ()]
147
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Runtime' )]
148
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SendAsyncStep []]
149
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
150
+ ${HttpPipelineAppend} ,
151
+
152
+ [Parameter (DontShow)]
153
+ [ValidateNotNull ()]
154
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Runtime' )]
155
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SendAsyncStep []]
156
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
157
+ ${HttpPipelinePrepend} ,
158
+
159
+ [Parameter ()]
160
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Runtime' )]
161
+ [System.Management.Automation.SwitchParameter ]
162
+ # Run the command asynchronously
163
+ ${NoWait} ,
164
+
165
+ [Parameter (DontShow)]
166
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Runtime' )]
167
+ [System.Uri ]
168
+ # The URI for the proxy server to use
169
+ ${Proxy} ,
170
+
171
+ [Parameter (DontShow)]
172
+ [ValidateNotNull ()]
173
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Runtime' )]
174
+ [System.Management.Automation.PSCredential ]
175
+ # Credentials for a proxy server to use for the remote call
176
+ ${ProxyCredential} ,
177
+
178
+ [Parameter (DontShow)]
179
+ [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category (' Runtime' )]
180
+ [System.Management.Automation.SwitchParameter ]
181
+ # Use the default credentials for the proxy
182
+ ${ProxyUseDefaultCredentials}
183
+ )
184
+
185
+ process {
186
+ if ($PSBoundParameters.ContainsKey (" ScriptLocalPath" ))
187
+ {
188
+ # Read Local File and add
189
+ $script = Get-Content - Path $ScriptLocalPath
190
+ $PSBoundParameters.Add (" SourceScript" , $script )
191
+ # If necessary, remove the -ParameterA parameter from the dictionary of bound parameters
192
+ $null = $PSBoundParameters.Remove (" ScriptLocalPath" )
193
+ }
194
+ Az.Compute\Set-AzVMRunCommand @PSBoundParameters
195
+ }
196
+ }
197
+
0 commit comments