@@ -154,12 +154,6 @@ public override void ExecuteCmdlet()
154
154
}
155
155
}
156
156
// END: For Cross-tenant RBAC sharing
157
- // GuestAttestation install scenario
158
- if ( shouldGuestAttestationExtBeInstalled ( parameters ) &&
159
- parameters . Identity == null )
160
- {
161
- parameters . Identity = new VirtualMachineScaleSetIdentity ( null , null , Microsoft . Azure . Management . Compute . Models . ResourceIdentityType . SystemAssigned , null ) ;
162
- }
163
157
164
158
// Standard securityType is currently not supported in API, jsut used on client side for now,
165
159
// so removing it here before API call is made.
@@ -194,93 +188,6 @@ public override void ExecuteCmdlet()
194
188
result = VirtualMachineScaleSetsClient . CreateOrUpdate ( resourceGroupName , vmScaleSetName , parameters ) ;
195
189
}
196
190
197
- //Guest Attestation extension defaulting behavior check.
198
- if ( shouldGuestAttestationExtBeInstalled ( parameters ) )
199
- {
200
- string extensionNameGA = "GuestAttestation" ;
201
- var extensionDirect = new VirtualMachineScaleSetExtension ( ) ;
202
- if ( this . VirtualMachineScaleSet . VirtualMachineProfile == null )
203
- {
204
- this . VirtualMachineScaleSet . VirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile ( ) ;
205
- }
206
- // ExtensionProfile
207
- if ( this . VirtualMachineScaleSet . VirtualMachineProfile . ExtensionProfile == null )
208
- {
209
- this . VirtualMachineScaleSet . VirtualMachineProfile . ExtensionProfile = new PSVirtualMachineScaleSetExtensionProfile ( ) ;
210
- }
211
- // Extensions
212
- if ( this . VirtualMachineScaleSet . VirtualMachineProfile . ExtensionProfile . Extensions == null )
213
- {
214
- this . VirtualMachineScaleSet . VirtualMachineProfile . ExtensionProfile . Extensions = new List < PSVirtualMachineScaleSetExtension > ( ) ;
215
- }
216
- if ( parameters . VirtualMachineProfile . OsProfile != null )
217
- {
218
- if ( parameters . VirtualMachineProfile . OsProfile . LinuxConfiguration != null )
219
- {
220
- extensionDirect . Name = extensionNameGA ;
221
- extensionDirect . Publisher = "Microsoft.Azure.Security.LinuxAttestation" ;
222
- extensionDirect . Type1 = extensionNameGA ;
223
- extensionDirect . TypeHandlerVersion = "1.0" ;
224
- extensionDirect . EnableAutomaticUpgrade = true ;
225
- }
226
- else
227
- {
228
- extensionDirect . Name = extensionNameGA ;
229
- extensionDirect . Publisher = "Microsoft.Azure.Security.WindowsAttestation" ;
230
- extensionDirect . Type1 = extensionNameGA ;
231
- extensionDirect . TypeHandlerVersion = "1.0" ;
232
- extensionDirect . EnableAutomaticUpgrade = true ;
233
- }
234
- }
235
- VirtualMachineScaleSetUpdate parametersupdate = new VirtualMachineScaleSetUpdate ( ) ;
236
- parametersupdate . VirtualMachineProfile = new VirtualMachineScaleSetUpdateVMProfile ( ) ;
237
- parametersupdate . VirtualMachineProfile . ExtensionProfile = new VirtualMachineScaleSetExtensionProfile ( ) ;
238
- parametersupdate . VirtualMachineProfile . ExtensionProfile . Extensions = new List < VirtualMachineScaleSetExtension > ( ) ;
239
- parametersupdate . VirtualMachineProfile . ExtensionProfile . Extensions . Add ( extensionDirect ) ;
240
- result = VirtualMachineScaleSetsClient . Update ( resourceGroupName , vmScaleSetName , parametersupdate ) ;
241
- var vmssVmExtParams = new VirtualMachineScaleSetVMExtension ( ) ;
242
- var resultVmssVm = VirtualMachineScaleSetVMsClient . List ( resourceGroupName , vmScaleSetName ) ;
243
- var resultList = resultVmssVm . ToList ( ) ;
244
- var nextPageLink = resultVmssVm . NextPageLink ;
245
- while ( ! string . IsNullOrEmpty ( nextPageLink ) )
246
- {
247
- var pageResult = VirtualMachineScaleSetVMsClient . ListNext ( nextPageLink ) ;
248
- foreach ( var pageItem in pageResult )
249
- {
250
- resultList . Add ( pageItem ) ;
251
- }
252
- nextPageLink = pageResult . NextPageLink ;
253
- }
254
- foreach ( var currentVmssVm in resultList )
255
- {
256
- if ( currentVmssVm . StorageProfile != null &&
257
- currentVmssVm . StorageProfile . OsDisk != null )
258
- {
259
- if ( currentVmssVm . StorageProfile . OsDisk . OsType == OperatingSystemTypes . Linux )
260
- {
261
- vmssVmExtParams = new VirtualMachineScaleSetVMExtension
262
- {
263
- Publisher = "Microsoft.Azure.Security.LinuxAttestation" ,
264
- Type1 = extensionNameGA ,
265
- TypeHandlerVersion = "1.0" ,
266
- EnableAutomaticUpgrade = true
267
- } ;
268
- }
269
- else
270
- {
271
- vmssVmExtParams = new VirtualMachineScaleSetVMExtension
272
- {
273
- Publisher = "Microsoft.Azure.Security.WindowsAttestation" ,
274
- Type1 = extensionNameGA ,
275
- TypeHandlerVersion = "1.0" ,
276
- EnableAutomaticUpgrade = true
277
- } ;
278
- }
279
- var opt = this . VirtualMachineScaleSetVMExtensionsClient . CreateOrUpdateWithHttpMessagesAsync ( resourceGroupName , vmScaleSetName , currentVmssVm . InstanceId , extensionNameGA , vmssVmExtParams ) ;
280
- }
281
- }
282
- }
283
-
284
191
var psObject = new PSVirtualMachineScaleSet ( ) ;
285
192
ComputeAutomationAutoMapperProfile . Mapper . Map < VirtualMachineScaleSet , PSVirtualMachineScaleSet > ( result , psObject ) ;
286
193
WriteObject ( psObject ) ;
@@ -419,36 +326,6 @@ private void trustedLaunchDefaultingImageValues()
419
326
420
327
}
421
328
422
- /// <summary>
423
- /// Check to see if the Guest Attestation extension should be installed and Identity set to SystemAssigned.
424
- /// Requirements for this scenario to be true:
425
- /// 1) DisableIntegrityMonitoring is not true.
426
- /// 2) SecurityType is TrustedLaunch.
427
- /// 3) SecureBootEnabled is true.
428
- /// 4) VTpmEnabled is true.
429
- /// </summary>
430
- /// <param name="vmssParameters"></param>
431
- /// <returns></returns>
432
- private bool shouldGuestAttestationExtBeInstalled ( VirtualMachineScaleSet vmssParameters )
433
- {
434
- if ( this . DisableIntegrityMonitoring != true &&
435
- vmssParameters != null &&
436
- vmssParameters . OrchestrationMode != "Flexible" &&
437
- vmssParameters . VirtualMachineProfile != null &&
438
- vmssParameters . VirtualMachineProfile . SecurityProfile != null &&
439
- vmssParameters . VirtualMachineProfile . SecurityProfile . SecurityType ? . ToLower ( ) == ConstantValues . TrustedLaunchSecurityType &&
440
- vmssParameters . VirtualMachineProfile . SecurityProfile . UefiSettings != null &&
441
- vmssParameters . VirtualMachineProfile . SecurityProfile . UefiSettings . SecureBootEnabled == true &&
442
- vmssParameters . VirtualMachineProfile . SecurityProfile . UefiSettings . VTpmEnabled == true )
443
- {
444
- return true ;
445
- }
446
- else
447
- {
448
- return false ;
449
- }
450
- }
451
-
452
329
/// This somewhat contradicts with the above behavior that sets UpgradePolicy to null.
453
330
/// There is some concern with the above behavior being correct or not, and requires additional testing before changing.
454
331
private void checkFlexibleOrchestrationModeParamsDefaultParamSet ( VirtualMachineScaleSet parameters )
@@ -520,11 +397,5 @@ private int convertAPIVersionToInt(string networkAPIVersion)
520
397
HelpMessage = "UserData for the Vmss, which will be Base64 encoded. Customer should not pass any secrets in here." ,
521
398
ValueFromPipelineByPropertyName = true ) ]
522
399
public string UserData { get ; set ; }
523
-
524
- [ Parameter (
525
- Mandatory = false ,
526
- ValueFromPipelineByPropertyName = true ,
527
- HelpMessage = "This flag disables the default behavior to install the Guest Attestation extension to the virtual machine if: 1) SecurityType is TrustedLaunch, 2) SecureBootEnabled on the SecurityProfile is true, 3) VTpmEnabled on the SecurityProfile is true." ) ]
528
- public SwitchParameter DisableIntegrityMonitoring { get ; set ; }
529
400
}
530
401
}
0 commit comments