-
Notifications
You must be signed in to change notification settings - Fork 0
feat(codespace): add Azure CLI devcontainer and az login guide #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,25 @@ | ||
| { | ||
| "name": "HYF Week 2 Assignment", | ||
| "image": "mcr.microsoft.com/devcontainers/python:3.11", | ||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "ms-python.python", | ||
| "ms-python.vscode-pylance" | ||
| ] | ||
| "name": "Week 2 Assignment", | ||
| "image": "mcr.microsoft.com/devcontainers/python:3.11", | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/azure-cli:1": {} | ||
| }, | ||
| "postCreateCommand": "python3 -m pip install -r task-1/requirements.txt", | ||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "ms-python.python", | ||
| "ms-python.vscode-pylance", | ||
| "ms-python.debugpy", | ||
| "charliermarsh.ruff" | ||
| ], | ||
| "settings": { | ||
| "python.defaultInterpreterPath": "/usr/local/bin/python", | ||
| "[python]": { | ||
| "editor.defaultFormatter": "charliermarsh.ruff", | ||
| "editor.formatOnSave": true | ||
| } | ||
| }, | ||
| "postCreateCommand": "python3 -m pip install -r task-1/requirements.txt && echo '✅ HYF Week 2 Assignment Codespace ready. Run the auto-grader locally with: bash .hyf/test.sh && cat .hyf/score.json'" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Logging in to Azure | ||
|
|
||
| The Week 2 assignment requires access to the HackYourFuture Azure tenant to upload files to Azure Blob Storage (Task 3). | ||
|
|
||
| ## In GitHub Codespaces | ||
|
|
||
| The Azure CLI is pre-installed in this Codespace. You only need to authenticate. | ||
|
|
||
| Run the following command in the Codespace terminal: | ||
|
|
||
| ```bash | ||
| az login --use-device-code | ||
| ``` | ||
|
|
||
| You will see output like: | ||
|
|
||
| ```text | ||
| To sign in, use a web browser to open the page https://microsoft.com/devicelogin | ||
| and enter the code XXXXXXXX to authenticate. | ||
| ``` | ||
|
|
||
| 1. Open [microsoft.com/devicelogin](https://microsoft.com/devicelogin) in your browser. | ||
| 2. Enter the code shown in the terminal. | ||
| 3. Sign in with the HackYourFuture credentials your teacher provided (format: `firstname.lastname@hackyourfuture.net` or similar). | ||
| 4. Return to the Codespace terminal. You should see your account details printed. | ||
|
|
||
| Verify the login succeeded: | ||
|
|
||
| ```bash | ||
| az account show --query "{user:user.name, subscription:name, tenant:homeTenantId}" --output table | ||
| ``` | ||
|
|
||
| The `user` field should show your HackYourFuture account email. | ||
|
|
||
| ## On your local machine | ||
|
|
||
| If you are working locally and the Azure CLI is already installed from Week 1, run: | ||
|
|
||
| ```bash | ||
| az login | ||
| ``` | ||
|
|
||
| This opens a browser window for you to sign in. After signing in, return to the terminal and verify with the command above. | ||
|
|
||
| If `az` is not installed, follow the [official installation guide](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) for your OS, then run `az login`. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **"The subscription is not in the HackYourFuture tenant"**: You are logged in with a personal or work account. Run `az logout`, then `az login --use-device-code` again and use the HYF credentials. | ||
|
|
||
| **"Authorization failed" on storage commands**: Your account may not have the `Storage Blob Data Contributor` role on `sthyfstudentsdemo`. Contact your teacher. | ||
|
|
||
| **Code expired**: The device login code is valid for 15 minutes. If it expires, re-run `az login --use-device-code` to get a new one. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.