az Verified current stable Not installed? Cloud Infrastructure

Az / Delete Api Management Service

Delete Api Management Service

Deletes an API Management service in Azure.

$
Terminal
az apim delete -n <name> -g <resource_group>

When To Use

During an API retirement phase or service consolidation.

Pro Tip

Consider using the `--no-wait` option to execute cleanup processes more efficiently.

Warning

Destructive operation. Confirm the target path and keep a backup before executing.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
Deleting API Management Service...\nService 'myApiManagementService' deleted successfully.\n\nDeleted Services:\n+-----------------------------+\n|          Name               |\n+-----------------------------+\n| myApiManagementService      |\n+-----------------------------+

Anatomy of Output

Understanding the result

Deleting API Management service: MyApiManagementService Service Name

Name of the API Management service targeted for deletion.

Provisioning State: Deleting Current State

Status indicating the deletion process is underway.

Successfully deleted API Management service. Success Message

Confirms successful removal of the service.

Power User Variants

Optimized versions

az apim delete -n service_name -g resource_group --yes

Delete API Management service without a confirmation prompt.

az apim delete -n service_name -g resource_group --no-wait

Delete API Management service asynchronously.

Troubleshooting

Common pitfalls

Resource group not found.

Solution: Ensure the specified resource group exists in Azure.

API Management service not found.

Solution: Verify the service name and its existence in the resource group.

Operation not permitted.

Solution: Check IAM permissions related to deleting API Management services.

Command Breakdown

What each part is doing

az
Base Command
The executable that performs this operation. Here it runs Az before the shell applies any redirect operators.
-n
n| name
The value supplied for n| name.
<name>
name
The value supplied for name.
-g
g| resource group
The value supplied for g| resource group.
<resource_group>
resource group
The value supplied for resource group.
-n
Command Option
Tool-specific option used by this command invocation.
-g
Command Option
Tool-specific option used by this command invocation.

How To Run

Execution path

  1. Step 1

    Run the command: az apim delete --name myApiManagementService --resource-group myResourceGroup

  2. Step 2

    To verify, use: az apim show --name myApiManagementService --resource-group myResourceGroup

Alternative Approaches

Comparable commands in other tools

Alternative cloud infrastructure tools for the same job.