Question

Difficulty: MediumAzure Portal, CLI, PowerShell, and Cloud Shell

An administrator uses Azure Cloud Shell to perform management tasks. During a session, the administrator saves a script file in the `/tmp` directory of the Cloud Shell environment. The administrator asserts that this script file will still be available in the `/tmp` directory when they launch a new Cloud Shell session the following day. Is this assertion true?

Answer: Answer

Answer

The assertion is false because Azure Cloud Shell only persists files saved within the mounted home directory, while files saved in other directories like `/tmp` are deleted when the session container is recycled.
The correct answer is false. Azure Cloud Shell runs on a temporary container that is destroyed when the session ends. Only the user's home directory ($HOME) is persisted via a mounted Azure Files share. Files written to any other directory, including `/tmp`, do not persist across sessions.

Step-by-Step Solution

1
Determine how Azure Cloud Shell provides persistence across sessions.
Cloud Shell utilizes an Azure Files share to persist files, specifically mounting it to the user's home directory ($HOME).
To identify the boundary of persistent storage in the Cloud Shell environment.
2
Evaluate the file location specified in the scenario.
The file was saved in the `/tmp` directory, which is outside of the persistent home directory ($HOME).
To verify whether the saved file resides inside or outside the persistent storage mount.
3
Determine the lifecycle of the Cloud Shell session container.
Cloud Shell containers are temporary and recycled upon session termination, resetting all non-persisted directories.
To conclude that the script in `/tmp` will be deleted once the container is destroyed.

Key Concept

Azure Cloud Shell container lifecycle and file persistence limitations
Rate this question