Skip to content

Instantly share code, notes, and snippets.

@rssnyder
Last active January 8, 2026 00:07
Show Gist options
  • Select an option

  • Save rssnyder/d62e51d78e9ba26f16e44da341abe3bd to your computer and use it in GitHub Desktop.

Select an option

Save rssnyder/d62e51d78e9ba26f16e44da341abe3bd to your computer and use it in GitHub Desktop.
remove hsf from a harness account
#!/bin/bash
echo "Deleting HSF in account $HARNESS_ACCOUNT_ID. Enter to proceed or Ctr-C to cancel..."
read
echo "Deleting org..."
curl -X DELETE 'https://app.harness.io/v1/orgs/Harness_Platform_Management' \
-H "x-api-key: $HARNESS_PLATFORM_API_KEY" \
-H "Harness-Account: $HARNESS_ACCOUNT_ID"
hsf_variables=("solutions_factory_project" "solutions_factory_endpoint" "solutions_factory_org" "solutions_factory_template_library_connector" "solutions_factory_template_library_repo" "custom_template_library_connector" "custom_template_library_repo" "enable_hsf_mini_factory")
echo "Deleting variables ${hsf_variables}..."
for item in "${hsf_variables[@]}"; do
curl -i -X DELETE "https://app.harness.io/ng/api/variables/${item}?accountIdentifier=$HARNESS_ACCOUNT_ID" \
-H "x-api-key: $HARNESS_PLATFORM_API_KEY" \
-H "Harness-Account: $HARNESS_ACCOUNT_ID"
done
echo "Deleting service account..."
curl -i -X DELETE "https://app.harness.io/ng/api/serviceaccount/harness_platform_manager?accountIdentifier=$HARNESS_ACCOUNT_ID" \
-H "x-api-key: $HARNESS_PLATFORM_API_KEY" \
-H "Harness-Account: $HARNESS_ACCOUNT_ID"
hsf_groups=("HSF_Admins" "HSF_Users")
echo "Deleting groups ${hsf_grups}..."
for item in "${hsf_groups[@]}"; do
curl -X DELETE "https://app.harness.io/v1/entities/account/usergroup/$item" \
-H "x-api-key: $HARNESS_PLATFORM_API_KEY" \
-H "Harness-Account: $HARNESS_ACCOUNT_ID"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment