Azion CLI unlink
Azion CLI command that unlinks a project folder from Azion and, when you confirm it, deletes the remote resources of the project.
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.
Usage
azion unlink runs in the project folder and asks two questions before it changes anything:
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.
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:
The command prints both questions with your answers and confirms the unlink:
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:
The cascade delete finds no application ID, and the command exits with code 1:
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.