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

Deletes all topics in a service bus #4

Open
GIHAA opened this issue Mar 22, 2024 · 4 comments · May be fixed by #14
Open

Deletes all topics in a service bus #4

GIHAA opened this issue Mar 22, 2024 · 4 comments · May be fixed by #14
Labels

Comments

@GIHAA
Copy link
Member

GIHAA commented Mar 22, 2024

resource_group=your_rg
namespace=your_namespace

topics=$(az servicebus topic list --resource-group $resource_group --namespace-name $namespace)

ids=""

for i in $(seq 0 $(echo "${topics}" | jq '. | length'))
do
   ids="$ids $(echo "${topics}" | jq ".[$i].id")"
done

az servicebus topic delete --resource-group $resource_group --namespace-name $namespace --ids $ids
@GIHAA GIHAA added the gist label Mar 22, 2024
@ThulinaWickramasinghe
Copy link
Collaborator

ThulinaWickramasinghe commented Apr 26, 2024

@QuintusJoyal Can you look into this?

@QuintusJoyal
Copy link
Member

QuintusJoyal commented Apr 26, 2024

To get all topic ids you can use --query global parameter
https://learn.microsoft.com/en-us/cli/azure/servicebus/topic?view=azure-cli-latest#az-servicebus-topic-list

ids=$(az servicebus topic list \
    --resource-group $resource_group \
    --namespace-name $namespace \
    --query "[].id" -o tsv)

@ThulinaWickramasinghe
Copy link
Collaborator

ThulinaWickramasinghe commented Apr 28, 2024

@QuintusJoyal Okay create the gist with the version using query. If it seems convenient add references, including ones to JMESPath.

cc -: @Akalanka47000

@ThulinaWickramasinghe
Copy link
Collaborator

@QbicSquid Can you look into this.

@QuintusJoyal QuintusJoyal linked a pull request May 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants