Allow Public IP DCP association with inherited protection - #29943
Allow Public IP DCP association with inherited protection#29943venkatasaimaram7 wants to merge 5 commits into
Conversation
Remove the client-side Enabled-only validation so Set-AzPublicIpAddress follows NRP behavior for VirtualNetworkInherited public IP addresses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b56be592-c5d7-45cf-bead-f5980b7da8f3
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution @venkatasaimaram7! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Az.Network Set-AzPublicIpAddress cmdlet to allow associating a DDoS custom policy when a Public IP uses inherited DDoS protection (VirtualNetworkInherited), relying on the Network Resource Provider (NRP) to validate eligibility and constraints.
Changes:
- Removed the client-side “ProtectionMode must be Enabled” guard when setting
-DdosCustomPolicyId. - Ensured DDoS settings are initialized when needed prior to assigning the custom policy reference.
- Updated module changelog/help text and refreshed the Public IP DDoS custom policy scenario test to exercise
VirtualNetworkInherited.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Network/Network/PublicIpAddress/SetAzurePublicIpAddressCommand.cs | Removes the local Enabled-only validation and initializes DdosSettings when associating a custom policy. |
| src/Network/Network/help/Set-AzPublicIpAddress.md | Updates example/parameter documentation to remove the prior Enabled-only requirement language. |
| src/Network/Network/ChangeLog.md | Adds an upcoming-release note describing the VirtualNetworkInherited association scenario. |
| src/Network/Network.Test/ScenarioTests/PublicIpAddressTests.ps1 | Updates the DDoS custom policy scenario to create/validate a Public IP using VirtualNetworkInherited. |
Suppressed comments (1)
src/Network/Network/help/Set-AzPublicIpAddress.md:151
- The
-DdosCustomPolicyIdparameter description removed all mention of DDoS protection mode. Since the service validates protection mode (includingVirtualNetworkInherited), documenting that validation makes the behavior clearer.
The DDoS custom policy ID to associate with a supported public IP address.
The service validates whether the public IP address attachment supports a DDoS custom policy.
This parameter cannot be used with `-RemoveDdosCustomPolicy`.
| The first command gets a Standard public IP address. | ||
| The second command associates the DDoS custom policy with the public IP address. The service | ||
| validates that the public IP address has a supported attachment, such as a network interface. |
| ---> | ||
|
|
||
| ## Upcoming Release | ||
| * Fixed `Set-AzPublicIpAddress` to allow DDoS custom policy association when the public IP address uses virtual network inherited protection mode. |
Keep the DCP scenario independent of DDoS protection mode and refresh its live recording. Clarify the changelog entry for the follow-up fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b56be592-c5d7-45cf-bead-f5980b7da8f3
The original Public IP DCP feature is still under Upcoming Release, so it does not need a separate fix entry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b56be592-c5d7-45cf-bead-f5980b7da8f3
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/Network/Network/PublicIpAddress/SetAzurePublicIpAddressCommand.cs:70
- When associating a DDoS custom policy, the cmdlet only initializes DdosSettings when it is null. However, Get-AzPublicIpAddress always materializes DdosSettings (via AutoMapper mapping that maps null to a new DdosSettings), so ProtectionMode can still be empty and the request will send a null/empty protection mode. To align with the intended support for inherited protection, set ProtectionMode to VirtualNetworkInherited when it’s not already provided before assigning DdosCustomPolicy.
if (this.PublicIpAddress.DdosSettings == null)
{
this.PublicIpAddress.DdosSettings = new PSDdosSettings();
}
src/Network/Network.Test/ScenarioTests/PublicIpAddressTests.ps1:816
- The updated scenario no longer asserts that the association results in VirtualNetworkInherited protection mode, so it doesn’t actually verify the PR’s intended behavior. Add an assertion for DdosSettings.ProtectionMode after attaching the custom policy to ensure the scenario exercises the inherited protection flow.
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
Assert-AreEqual $expected.Name $actual.Name
Assert-AreEqual $dcp.Id $expected.DdosSettings.DdosCustomPolicy.Id
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
please sync your branch with main and update changelog.md |
Update the existing unreleased feature entry after syncing the PR branch with main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b56be592-c5d7-45cf-bead-f5980b7da8f3
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/Network/Network/ChangeLog.md:25
- Changelog entry is written in present tense; this section’s entries are consistently phrased in past tense (e.g., “Added…”, “Fixed…”). Reword this bullet to past tense to match the established ChangeLog.md format.
- DDoS custom policy association does not require a specific DDoS protection mode.
Description
Follow-up to #29925. Removes the client-side requirement that a Public IP address use DDoS protection mode
Enabledbefore associating a DDoS custom policy.NRP accepts DDoS custom policy association for supported Standard Public IP attachments using
VirtualNetworkInherited. The service remains authoritative for SKU, attachment, policy state, subscription, and region validation.Changes
Enabled-only guard fromSet-AzPublicIpAddress.VirtualNetworkInheritedin the Public IP DCP scenario and refresh its live recording.Testing
TestPublicIpDdosCustomPolicyrecording passed.TestPublicIpDdosCustomPolicypassed.