# Azion CLI unlink

The Azion CLI `unlink` command detaches the project in the current directory from Azion by removing its `azion` folder. On request, it also deletes the remote resources of the project. Use it before you link the folder to a different application, for example. The options every command accepts, such as `--format`, `--out`, and `-y`, are on [Global options](/en/documentation/devtools/cli/globals/).

---

## Usage

`azion unlink` runs in the project folder and asks two questions before it changes anything:

```bash
azion unlink [flags]
```

The command takes no flags of its own. `-h` or `--help` prints its help.

| Question                                                   | Answer `y`                                                      | Answer `n`                                                 |
| ---------------------------------------------------------- | --------------------------------------------------------------- | ---------------------------------------------------------- |
| `Do you want to unlink this project? (y/N)`                | Asks the second question.                                       | Ends the command. The project folder stays as it was.      |
| `Would you like to delete remote resources as well? (y/N)` | Starts a cascade delete of the remote resources of the project. | Removes the `azion` folder and keeps the remote resources. |

Unlinking removes only the `azion` folder. The `.edge` folder, the `azion.config.cjs` or `azion.config.mjs` file, and the lines the CLI added to `.gitignore` stay in the project. When the remote resources stay, you can link the folder again later.

> **Caution**
>
> `azion unlink -y` answers yes to both questions, so it also deletes the remote resources that [azion deploy](/en/documentation/devtools/cli/deploy/) created for the project. To keep them, run `azion unlink` without `-y` and answer `n` to the second question.

The cascade delete reads the application ID from `azion/azion.json`. On a project that was never deployed, the file has no ID, so the command stops with an error and removes nothing.

---

## Examples

Each example shows the command and the output it prints.

### Unlink and keep the remote resources

This command unlinks the project in the current directory. Answer `y` to the first question and `n` to the second:

```bash
azion unlink
```

The command prints both questions with your answers and confirms the unlink:

```text
🤔 Do you want to unlink this project? (y/N) y
🤔 Would you like to delete remote resources as well? (y/N) n
Unliked successfully
```

The `azion` folder is no longer in the project. The `.edge` folder, `azion.config.cjs`, and the `.gitignore` entries are unchanged.

### Unlink a project that was never deployed

This command answers yes to both questions in a project that has an `azion` folder but no deploy yet:

```bash
azion unlink -y
```

The cascade delete finds no application ID, and the command exits with code `1`:

```text
Cascade deleting resources
Error: Application ID is missing from azion.json. Please initialize and deploy your project before using cascade delete
```

The project folder keeps every file, the `azion` folder included. To unlink this project, run `azion unlink` without `-y` and answer `n` to the second question.

---

## Related resources

- [Global options](/en/documentation/devtools/cli/globals.md): The options every command accepts, such as `-y`, which answers every yes or no question with yes.
- [Azion CLI link](/en/documentation/devtools/cli/link-command.md): The command that creates the `azion` folder that unlink removes.
- [Azion CLI reset](/en/documentation/devtools/cli/reset.md): The command that restores the stored settings of the CLI to their defaults.
- [Azion CLI login](/en/documentation/devtools/cli/login.md): The command that authenticates the CLI before you link or deploy a project.
