You can easily forget the VM password, loose the SSH key, but don't worry, it's not the end of the world! In Azure, you can easily reset VM admin password, you will practice it in this task.
Tasks in this module are relying on 2 PowerShell scripts:
scripts/generate-artifacts.ps1
generates the task "artifacts" and uploads them to cloud storage. An "artifact" is evidence of a task completed by you. Each task will have its own script, which will gather the required artifacts. The script also adds a link to the generated artifact in theartifacts.json
file in this repository โ make sure to commit changes to this file after you run the script.scripts/validate-artifacts.ps1
validates the artifacts generated by the first script. It loads information about the task artifacts from theartifacts.json
file.
Here is how to complete tasks in this module:
-
Clone task repository
-
Make sure you completed steps, described in the Prerequisites section
-
Complete the task, described in the Requirements section
-
Run
scripts/generate-artifacts.ps1
to generate task artifacts. Script will update the fileartifacts.json
in this repo. -
Run
scripts/validate-artifacts.ps1
to test yourself. If tests are failing - follow the recomendation from the test script error message to fix or re-deploy your infrastructure. When you will be ready to test yourself again - re-generate the artifacts (step 4) and re-run tests again. -
When all tests will pass - commit your changes and submit the solution for a review.
Pro tip: if you stuck with any of the implementation steps - run scripts/generate-artifacts.ps1
and scripts/validate-artifacts.ps1
. The validation script might give you a hint on what you should do.
Before completing any task in the module, make sure that you followed all the steps described in the Environment Setup topic, in particular:
-
Ensure you have an Azure account and subscription.
-
Create a resource group called "mate-resources" in the Azure subscription.
-
In the "mate-resources" resource group, create a storage account (any name) and a "task-artifacts" container.
-
Install PowerShell 7 on your computer. All tasks in this module use Powershell 7. To run it in the terminal, execute the following command:
pwsh
-
Install Azure module for PowerShell 7:
Install-Module -Name Az -Repository PSGallery -Force
If you are a Windows user, before running this command, please also run the following:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- Log in to your Azure account using PowerShell:
Connect-AzAccount -TenantId <your Microsoft Entra ID tenant id>
In this task, you need to perform the following steps:
-
Use the infrastructure, you created in the previous task. Reset the VM admin password on the virtual machine you created earlied:
-
use username, which is different from one you used to create the VM
-
use password authentification for the user.
-
after password reset, connect to the VM with the new credentials using SSH to test if password has been reset.
-
-
Run artifacts generation script
scripts/generate-artifacts.ps1
-
Test yourself using the script
scripts/validate-artifacts.ps1
-
Sumbit the solution for a review
-
When solution is validated, stop the virtual machine.