A private endpoint named PE1 already exists in Subnet3 of VNet1. You have two application security groups:
- ASG-App: the first network interface assigned to ASG-App is in VNet1.
- ASG-Hub: the first network interface assigned to ASG-Hub is in VNet2.
Requirements:
- PE1 must become a member of an existing application security group.
- PE1 must not be deleted or re-created.
- The change must be scripted for repeatability.
Which action meets all the requirements?
Why
Azure supports adding an ASG to a private endpoint that already exists, and the Azure CLI command az network private-endpoint asg add does this from a script without re-creating the endpoint. The chosen ASG must be bound to the same virtual network as PE1, so only ASG-App (VNet1) qualifies. Re-creating the endpoint violates the no-re-creation requirement, and the portal steps are not scripted.
- Not correct: In the Azure portal, open PE1, select Application security groups, and select ASG-App. The portal can associate an ASG with an existing private endpoint, but it is a manual procedure, not a scripted one.
- Not correct: Delete PE1, then run
az network private-endpoint createwith--asgset to ASG-App. Associating the ASG at creation works, but this requires deleting and re-creating PE1, which the requirements forbid. - Correct: Run
az network private-endpoint asg addfor PE1 with the ID of ASG-App. This Azure CLI command associates an ASG with an existing private endpoint, and ASG-App's members are in VNet1, the same virtual network as PE1. - Not correct: Run
az network private-endpoint asg addfor PE1 with the ID of ASG-Hub. All network interfaces in an ASG must be in the same virtual network as its first assigned interface; PE1 is in VNet1, but ASG-Hub is bound to VNet2.
Source