Skip to content

Instantly share code, notes, and snippets.

@Himura2la
Created May 15, 2026 13:05
Show Gist options
  • Select an option

  • Save Himura2la/2f7dc3662f30348f031830b6a455c804 to your computer and use it in GitHub Desktop.

Select an option

Save Himura2la/2f7dc3662f30348f031830b6a455c804 to your computer and use it in GitHub Desktop.
Clean up Data files from Azure OpenAI account, that may remain after batch jobs
#!/bin/bash
set -x
AzureOpenAiEndpoint=""
AzureOpenAiApiKey=""
# https://learn.microsoft.com/en-us/rest/api/azureopenai/files
curl -X GET -H "Api-key: $AzureOpenAiApiKey" "${AzureOpenAiEndpoint}openai/files?api-version=2024-10-21" | jq -r '.data[].id' | while read -r file_id; do
curl -X DELETE -H "Api-key: $AzureOpenAiApiKey" "${AzureOpenAiEndpoint}openai/files/$file_id?api-version=2024-10-21"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment