Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQ] DeleteOptions on Public Ip Address #38806

Closed
jloisel opened this issue Feb 16, 2024 · 12 comments
Closed

[FEATURE REQ] DeleteOptions on Public Ip Address #38806

jloisel opened this issue Feb 16, 2024 · 12 comments
Assignees
Labels
ARM customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request This issue requires a new behavior in the product in order be resolved. Mgmt This issue is related to a management-plane library. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue.

Comments

@jloisel
Copy link

jloisel commented Feb 16, 2024

It's currently not possible to set DeleteOptions on a public ip address through the SDK, when creating it:

    final PublicIpAddress.DefinitionStages.WithCreate publicIp = publicIps
      .define(name)
      .withRegion(region)
      .withExistingResourceGroup(resourceGroup)
      .withoutLeafDomainLabel()
      .withoutReverseFqdn()
      .withSku(STANDARD)
      .withDynamicIP();

Would be useful to have it (as disk / network interfaces on a VM), to allow deleting the public ip automatically when the vm is deleted. As of now, we need to do this manually which is cumbersome.

@github-actions github-actions bot added ARM customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 16, 2024
@joshfree joshfree added feature-request This issue requires a new behavior in the product in order be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-team-triage Workflow: This issue needs the team to triage. labels Feb 16, 2024
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Feb 16, 2024
@joshfree
Copy link
Member

Thanks for filing this request, @jloisel. @weidongxu-microsoft could you help triage this

@weidongxu-microsoft
Copy link
Member

@XiaofeiCao Do we know whether network RP behave correctly on this (delete IP address when delete VM)?

We can have Hong try it.

@XiaofeiCao
Copy link
Contributor

According to my knowledge, deleteOption is only effective on NetworkInterface's PublicIpAddress property, not PublicIpAddress or VirtualMachine itself.
@v-hongli1 Would you help try whether deleteOption works on PublicIpAddress?

@v-hongli1
Copy link
Member

v-hongli1 commented Feb 19, 2024

@XiaofeiCao

  1. I tried to fix the azure-resourcemanager-network interface and tested and found that deleteOption does not works on PublicIpAddress and does not return this item.
    The test result following as:
    PublicIPAccessTests.testCreateIPAccessWithDeleteOptionDelete.json
  2. Now the deleteOption is also not supported on Public IP Address in the portal.

@XiaofeiCao
Copy link
Contributor

@v-hongli1 Got it. The deleteOption may not be visible in the PublicIpAddress's properties, but it may ACTUALLY take effect.
Would you help confirm whether this deleteOption takes effect when deleting the VM that it attaches to(though if I remembered correctly, it does not)?

@v-hongli1
Copy link
Member

v-hongli1 commented Feb 20, 2024

@XiaofeiCao
Regardless of whether .withPrimaryNetworkInterfaceDeleteOptions(DeleteOptions.DELETE) is loaded when the virtual machine is created, the Public IP Address is not removed when the virtual machine is removed. I think Public IP Address may not contain deleteOption in its properties.

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Feb 20, 2024

@v-hongli1

It is in PublicIpAddress https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/models/PublicIpAddressInner.java#L497-L499

But if it does not have effect, then it may not be supported yet (or have bug in backend).

Could you try this on portal and see if this deletes IpAddress when delete VM?

image

If yes, check the resource create by Portal.

@weidongxu-microsoft
Copy link
Member

@XiaofeiCao Do you aware any other option that may help user delete the IpAdress with the VM?

@XiaofeiCao
Copy link
Contributor

XiaofeiCao commented Feb 20, 2024

My experience is that the PublicIpAddress deleteOption is in NetworkInterface resource.

There's also a potential backend bug: If PublicIpAddress deleteOption is not set when attached to NetworkInterface(whether using RP's API or deployment template), it'll always be null, regardless of future updates(luckily Databricks has set deleteOption in their create deployment template)...
Azure/azure-rest-api-specs#25475
Our SDK didn't set this property during PublicIpAddress attach, so even update won't work.

For above reason, I'm afraid for now we'll have to wait for the feature to be added.

@XiaofeiCao
Copy link
Contributor

@jloisel Due to service implementation limitation, the deleteOption should be set on the NetworkInterface that the PublicIpAddress is attached to.
Here's how to set PublicIpAddress delete option in NetworkInterface with latest 2.40.0 SDK:

// create nic with PublicIpAddress delete option
NetworkInterface nic = networkManager.networkInterfaces()
  .define(generateRandomResourceName("nic-", 15))
  .xx()
  .withNewPrimaryPublicIPAddress()
  .withPrimaryPublicIPAddressDeleteOptions(DeleteOptions.DELETE) // set primary publicIpAddress deleteOptions
  .create();

// update delete option
nic.update()
  .withPrimaryPublicIPAddressDeleteOptions(DeleteOptions.DELETE)
  .apply();

@XiaofeiCao XiaofeiCao added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Jul 11, 2024
@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jul 11, 2024
Copy link

Hi @jloisel. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

Copy link

Hi @jloisel, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@github-actions github-actions bot added the no-recent-activity There has been no recent activity on this issue. label Jul 18, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ARM customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request This issue requires a new behavior in the product in order be resolved. Mgmt This issue is related to a management-plane library. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue.
Projects
None yet
Development

No branches or pull requests

5 participants