Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Azure Virtual Machine (VM) with Just-in-Time access

License

NotificationsYou must be signed in to change notification settings

epomatti/az-vm-jit

Repository files navigation

Azure Virtual Machine (VM) with Just-in-Time access.

You'll need to enableMicrosoft Defender for Servers for the Subscription.

Tip

Entra ID P2 license is also required for PIM

Make sure you enableCloud Workload Protection (CWP) forServers. After that, install the agents using the Portal just for completeness.

Create the.auto.tfvars file and set the required parameters:

cp config/template.tfvars .auto.tfvars

Create the temporary keys:

mkdir .keys&& ssh-keygen -f .keys/temp_rsa

Start by creating the sandbox infrastructure:

terraform initterraform apply -auto-approve

Tip

If you get the error'LinuxJITPolicy' is not onboarded to Defender For Servers offering., add the server to Defender and apply again to finish the setup.

JIT

If everything goes right, the JIT policy will automatically be created to the VM by the TerraformAzApi provider.

Permissions required are:

  • Microsoft.Security/locations/jitNetworkAccessPolicies/initiate/action
  • Microsoft.Compute/virtualMachines/read

To be able to login with Entra ID credentials, users must have one of:

  • Virtual Machine Administrator Login
  • Virtual Machine User Login

Defender should have created the followingDeny rule:

Now request your JIT access.

Defender should create the followingAllow rule:

VMAccess extension

It is possible to extend VM management capabilities using theVMAccess extension.

To install the extension using Terraform:

# VMAccessinstall_vmaccess_extension =true

To check for deployed extensions and the installation status:

az vm extension list \    --resource-group<resource-group> \    --vm-name<vm-name> -o table

Clean-up

Don't forget to disable Microsoft Defender if you're only testing.

Destroy the infrastructure:

terraform destroy -auto-approve

[8]ページ先頭

©2009-2025 Movatter.jp