Final answer:
The correct answer is A) Use Azure PowerShell, grant access, obtain token.
Step-by-step explanation:
The correct answer is A) Use Azure PowerShell, grant access, obtain token. Azure PowerShell is a command-line tool that allows you to manage and automate Azure resources. By using Azure PowerShell, you can grant VM access to an Azure resource and obtain an access token from Azure Resource Manager. Here's an example of the PowerShell commands you could use:
- Connect-AzAccount
- Set-AzContext -SubscriptionId <subscription_id>
- $vm = Get-AzVM -ResourceGroupName <resource_group_name> -Name <vm_name>
- New-AzRoleAssignment -ObjectId <objectId_of_user> -RoleDefinitionName 'Contributor' -Scope $vm.Id
- $token = (Get-AzAccessToken).Token