---
title: 'Avi/NSX ALB: Deleting httppolicyset via CLI'
url: 'https://patrik.kernstock.net/blog/nsx-alb-avi-deleting-httppolicyset-via-cli'
markdown: 'https://patrik.kernstock.net/blog/nsx-alb-avi-deleting-httppolicyset-via-cli.md'
date: '2021-06-07'
description: 'VMware NSX Advanced Load Balancer – also known as AVI Vantage – is a very comprehensive load balancer I was implementing in my lab the last days. The context By default AVI Controller creates one HTTP-Policy-Set per Virtual Service by default and can be managed via UI. However the UI does not allow…'
taxonomy:
  category:
    - VMware
    - 'NSX & Avi'
  tag:
    - 'Avi Load Balancer'
    - QuickTip
---

# [Avi/NSX ALB: Deleting httppolicyset via CLI](https://patrik.kernstock.net/blog/nsx-alb-avi-deleting-httppolicyset-via-cli)

   June 7, 2021  (updated August 22, 2021)   1 min 

   [VMware](https://patrik.kernstock.net/category:VMware) [NSX & Avi](https://patrik.kernstock.net/category:NSX%20%26%20Avi)    [Avi Load Balancer](https://patrik.kernstock.net/tag:Avi%20Load%20Balancer) [QuickTip](https://patrik.kernstock.net/tag:QuickTip)  

 Note

This article is more than 5 year(s) old – information may be outdated.

 ![Avi/NSX ALB: Deleting httppolicyset via CLI](https://patrik.kernstock.net/images/2/0/2/1/-/2021-06-0617-02-18-i1xg0icj-b8683f86.png?g-b3a1b014 "Avi/NSX ALB: Deleting httppolicyset via CLI") 

VMware NSX Advanced Load Balancer – also known as AVI Vantage – is a very comprehensive load balancer I was implementing in my lab the last days.

# The context

By default AVI Controller creates one HTTP-Policy-Set per Virtual Service by default and can be managed via UI. However the UI does not allow to create multiple ones, but still multiple sets are indeed supported. The only caveat is that they can only be created/deleted via CLI/API only.

As part of some troubleshooting an automatism created an additional HTTP-Policy-Set, but did not remove it. Hence having one additional HTTP-Policy-Set stuck on my virtual service.

# The "issue"

When trying to delete it via CLI, you might end up with:

```shell
[admin:avicontroller]: > delete httppolicyset Test-LetsEncryptHTTPpolicy
{"error": "Cannot delete, object is referred by: ['VirtualService TestWeb']", "obj_name": "Test-LetsEncryptHTTPpolicy"}
[admin:avicontroller]: >
```

# The solution

To delete additional HTTP-Policy-Sets do the following:

1. Connect to the AVI Controller via SSH
2. Open the custom shell by typing `shell` and logging in
3. Configure the virtualservice by switching into the `virtualservice` context:

    ```shell
    [admin:avicontroller]: > configure virtualservice TestWeb
    Updating an existing object. Currently, the object is:
    +------------------------------------+-----------------------------------------------------+
    | Field                              | Value                                               |
    +------------------------------------+-----------------------------------------------------+
    | uuid                               | virtualservice-56b7eb0c-5044-4700-a217-3784a6f0d397 |
    | name                               | TestWeb                                             |
    [...]
    ```
4. De-reference the `httppolicyset` and `exit` the context by using:

    ```shell
    [admin:avicontroller]: virtualservice> no http_policies index 1
    Removed http_policies with index 1

    [admin:avicontroller]: virtualservice> exit
    +------------------------------------+-----------------------------------------------------+
    | Field                              | Value                                               |
    [...]
    ```
5. List all HTTP-Policies-Sets by using the auto-completion via tab:

    ```shell
    [admin:avicontroller]: > delete httppolicyset[tab]
    Test-LetsEncryptHTTPpolicy
    ```
6. Finally delete the `httppolicyset` by using:

    ```shell
    [admin:avicontroller]: > delete httppolicyset Test-LetsEncryptHTTPpolicy
    Successfully deleted Test-LetsEncryptHTTPpolicy.
    ```

All done!

##     Comments    

 Sort by: 

Loading comments...

---

## Navigation

- Parent: [Blog](https://patrik.kernstock.net/index.md)
- Previous: [ADFS 2019: Allow logon with sAMAccountName](https://patrik.kernstock.net/blog/adfs-2019-allow-logon-with-samaccountname.md)
- Next: [vCenter 7.0 U2: "Swap File Location" cannot be changed to different datastore](https://patrik.kernstock.net/blog/vcenter-7-0-u2-swap-file-location-cannot-be-changed-to-different-datastore.md)
