I provisioned a Virtual Machine ScaleSet in Azure. Now, i want to assign an Application Security Group to the Scaleset:
This is the Scaleset
$vmssWeb = get-azvmss -ResourceGroupName webRG -VMScaleSetName webVMSS
This is the Application Security Group
$asgWeb = Get-AzApplicationSecurityGroup -ResourceGroupName webRG -Name webASG
This is the nic associated to the Scaleset
$nic = $vmss1.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0]
This line generates the error when i want to associate the ASG to VMSS
$nic.IpConfigurations[0].ApplicationSecurityGroups = $asgWeb
Usually this works when we work with NICs. Not in this case :-(
-----------------
Error:
Exception setting "ApplicationSecurityGroups": "Cannot convert the "Microsoft.Azure.Commands.Network.Models.PSApplicationSecurityGroup" value of type
"Microsoft.Azure.Commands.Network.Models.PSApplicationSecurityGroup" to type "System.Collections.Generic.IList`1[Microsoft.Azure.Management.Compute.Models.SubResource]"."
At line:1 char:1
+ $nic.IpConfigurations[0].ApplicationSecurityGroups = $asgWeb
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
Any advice?