You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/active-directory/devices/howto-vm-sign-in-azure-ad-linux.md
+35-14Lines changed: 35 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ services: active-directory
6
6
ms.service: active-directory
7
7
ms.subservice: devices
8
8
ms.topic: how-to
9
-
ms.date: 11/22/2021
9
+
ms.date: 06/16/2022
10
10
11
11
ms.author: joflore
12
12
author: MicrosoftGuyJFlo
@@ -99,17 +99,17 @@ Ensure your VM is configured with the following functionality:
99
99
100
100
Ensure your client meets the following requirements:
101
101
102
-
- SSH client must support OpenSSH based certificates for authentication. You can use Az CLI (2.21.1 or higher) with OpenSSH (included in Windows 10 version 1803 or higher) or Azure Cloud Shell to meet this requirement.
103
-
- SSH extension for Az CLI. You can install this using `az extension add --name ssh`. You don’t need to install this extension when using Azure Cloud Shell as it comes pre-installed.
104
-
- If you’re using any other SSH client other than Az CLI or Azure Cloud Shell that supports OpenSSH certificates, you’ll still need to use Az CLI with SSH extension to retrieve ephemeral SSH cert and optionally a config file and then use the config file with your SSH client.
102
+
- SSH client must support OpenSSH based certificates for authentication. You can use Azure CLI (2.21.1 or higher) with OpenSSH (included in Windows 10 version 1803 or higher) or Azure Cloud Shell to meet this requirement.
103
+
- SSH extension for Azure CLI. You can install this using `az extension add --name ssh`. You don’t need to install this extension when using Azure Cloud Shell as it comes pre-installed.
104
+
- If you’re using any other SSH client other than Azure CLI or Azure Cloud Shell that supports OpenSSH certificates, you’ll still need to use Azure CLI with SSH extension to retrieve ephemeral SSH cert and optionally a config file and then use the config file with your SSH client.
105
105
- TCP connectivity from the client to either the public or private IP of the VM (ProxyCommand or SSH forwarding to a machine with connectivity also works).
106
106
107
107
> [!IMPORTANT]
108
108
> SSH clients based on PuTTy do not support openSSH certificates and cannot be used to login with Azure AD openSSH certificate-based authentication.
109
109
110
110
## Enabling Azure AD login in for Linux VM in Azure
111
111
112
-
To use Azure AD login in for Linux VM in Azure, you need to first enable Azure AD login option for your Linux VM, configure Azure role assignments for users who are authorized to login in to the VM and then use SSH client that supports OpensSSH such as Az CLI or Az Cloud Shell to SSH to your Linux VM. There are multiple ways you can enable Azure AD login for your Linux VM, as an example you can use:
112
+
To use Azure AD login in for Linux VM in Azure, you need to first enable Azure AD login option for your Linux VM, configure Azure role assignments for users who are authorized to login in to the VM and then use SSH client that supports OpensSSH such as Azure CLI or Az Cloud Shell to SSH to your Linux VM. There are multiple ways you can enable Azure AD login for your Linux VM, as an example you can use:
113
113
114
114
- Azure portal experience when creating a Linux VM
115
115
- Azure Cloud Shell experience when creating a Windows VM or for an existing Linux VM
@@ -224,11 +224,11 @@ az role assignment create \
224
224
225
225
For more information on how to use Azure RBAC to manage access to your Azure subscription resources, see the article [Steps to assign an Azure role](../../role-based-access-control/role-assignments-steps.md).
226
226
227
-
## Install SSH extension for Az CLI
227
+
## Install SSH extension for Azure CLI
228
228
229
-
If you’re using Azure Cloud Shell, then no other setup is needed as both the minimum required version of Az CLI and SSH extension for Az CLI are already included in the Cloud Shell environment.
229
+
If you’re using Azure Cloud Shell, then no other setup is needed as both the minimum required version of Azure CLI and SSH extension for Azure CLI are already included in the Cloud Shell environment.
230
230
231
-
Run the following command to add SSH extension for Az CLI
231
+
Run the following command to add SSH extension for Azure CLI
232
232
233
233
```azurecli
234
234
az extension add --name ssh
@@ -245,11 +245,11 @@ az extension show --name ssh
245
245
You can enforce Conditional Access policies such as require multi-factor authentication, require compliant or hybrid Azure AD joined device for the device running SSH client, and checking for risk before authorizing access to Linux VMs in Azure that are enabled with Azure AD login in. The application that appears in Conditional Access policy is called "Azure Linux VM Sign-In".
246
246
247
247
> [!NOTE]
248
-
> Conditional Access policy enforcement requiring device compliance or Hybrid Azure AD join on the client device running SSH client only works with Az CLI running on Windows and macOS. It is not supported when using Az CLI on Linux or Azure Cloud Shell.
248
+
> Conditional Access policy enforcement requiring device compliance or Hybrid Azure AD join on the client device running SSH client only works with Azure CLI running on Windows and macOS. It is not supported when using Azure CLI on Linux or Azure Cloud Shell.
249
249
250
250
## Login using Azure AD user account to SSH into the Linux VM
251
251
252
-
### Using Az CLI
252
+
### Using Azure CLI
253
253
254
254
First do az login and then az ssh vm.
255
255
@@ -265,7 +265,7 @@ The following example automatically resolves the appropriate IP address for the
265
265
az ssh vm -n myVM -g AzureADLinuxVM
266
266
```
267
267
268
-
If prompted, enter your Azure AD login credentials at the login page, perform an MFA, and/or satisfy device checks. You’ll only be prompted if your az CLI session doesn’t already meet any required Conditional Access criteria. Close the browser window, return to the SSH prompt, and you’ll be automatically connected to the VM.
268
+
If prompted, enter your Azure AD login credentials at the login page, perform an MFA, and/or satisfy device checks. You’ll only be prompted if your Azure CLI session doesn’t already meet any required Conditional Access criteria. Close the browser window, return to the SSH prompt, and you’ll be automatically connected to the VM.
269
269
270
270
You’re now signed in to the Azure Linux virtual machine with the role permissions as assigned, such as VM User or VM Administrator. If your user account is assigned the Virtual Machine Administrator Login role, you can use sudo to run commands that require root privileges.
271
271
@@ -308,7 +308,7 @@ Use the following example to authenticate to Azure CLI using the service princip
308
308
az login --service-principal -u <sp-app-id> -p <password-or-cert> --tenant <tenant-id>
309
309
```
310
310
311
-
Once authentication with a service principal is complete, use the normal Az CLI SSH commands to connect to the VM.
311
+
Once authentication with a service principal is complete, use the normal Azure CLI SSH commands to connect to the VM.
312
312
313
313
```azurecli
314
314
az ssh vm -n myVM -g AzureADLinuxVM
@@ -389,12 +389,33 @@ For customers who are using previous version of Azure AD login for Linux that wa
389
389
390
390
## Using Azure Policy to ensure standards and assess compliance
391
391
392
-
Use Azure Policy to ensure Azure AD login is enabled for your new and existing Linux virtual machines and assess compliance of your environment at scale on your Azure Policy compliance dashboard. With this capability, you can use many levels of enforcement: you can flag new and existing Linux VMs within your environment that don’t have Azure AD login enabled. You can also use Azure Policy to deploy the Azure AD extension on new Linux VMs that don’t have Azure AD login enabled, as well as remediate existing Linux VMs to the same standard. In addition to these capabilities, you can also use Azure Policy to detect and flag Linux VMs that have non-approved local accounts created on their machines. To learn more, review [Azure Policy](../../governance/policy/overview.md).
392
+
Use Azure Policy to ensure Azure AD login is enabled for your new and existing Linux virtual machines and assess compliance of your environment at scale on your Azure Policy compliance dashboard. With this capability, you can use many levels of enforcement: you can flag new and existing Linux VMs within your environment that don’t have Azure AD login enabled. You can also use Azure Policy to deploy the Azure AD extension on new Linux VMs that don’t have Azure AD login enabled, and remediate existing Linux VMs to the same standard. In addition to these capabilities, you can also use Azure Policy to detect and flag Linux VMs that have non-approved local accounts created on their machines. To learn more, review [Azure Policy](../../governance/policy/overview.md).
393
393
394
394
## Troubleshoot sign-in issues
395
395
396
396
Some common errors when you try to SSH with Azure AD credentials include no Azure roles assigned, and repeated prompts to sign in. Use the following sections to correct these issues.
397
397
398
+
### Missing application
399
+
400
+
If the Azure Linux VM Sign-in application is missing from Conditional Access, use the following steps to remediate the issue:
401
+
402
+
1. Check to make sure the application isn't in the tenant by:
403
+
1. Sign in to the **Azure portal**.
404
+
1. Browse to **Azure Active Directory** > **Enterprise applications**
405
+
1. Remove the filters to see all applications, and search for "VM". If you don't see Azure Linux VM Sign-in as a result, the service principal is missing from the tenant.
406
+
407
+
Another way to verify it is via Graph PowerShell:
408
+
409
+
1. [Install the Graph PowerShell SDK](/powershell/microsoftgraph/installation) if you haven't already done so.
1. `Get-MgServicePrincipal -ConsistencyLevel eventual -Search '"DisplayName:Azure Linux VM"'`
414
+
1. If this command results in no output and returns you to the PowerShell prompt, you can create the Service Principal with the following Graph PowerShell command:
1. Successful output will show that the AppID and the Application Name Azure Linux VM Sign-in was created.
417
+
1. Sign out of Graph PowerShell when complete with the following command: `Disconnect-MgGraph`
418
+
398
419
### Couldn’t retrieve token from local cache
399
420
400
421
You must run az login again and go through an interactive sign in flow. Review the section [Using Az Cloud Shell](#using-az-cloud-shell).
@@ -468,7 +489,7 @@ Virtual machine scale set VM connections may fail if the virtual machine scale s
468
489
469
490
### AllowGroups / DenyGroups statements in sshd_config cause first login to fail for Azure AD users
470
491
471
-
Cause 1: If sshd_config contains either AllowGroups or DenyGroups statements, the very first login fails for Azure AD users. If the statement was added after a user already has a successful login, they can log in.
492
+
Cause 1: If sshd_config contains either AllowGroups or DenyGroups statements, the first login fails for Azure AD users. If the statement was added after a user already has a successful login, they can log in.
472
493
473
494
Solution 1: Remove AllowGroups and DenyGroups statements from sshd_config.
Copy file name to clipboardExpand all lines: articles/active-directory/devices/howto-vm-sign-in-azure-ad-windows.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ services: active-directory
6
6
ms.service: active-directory
7
7
ms.subservice: devices
8
8
ms.topic: how-to
9
-
ms.date: 04/01/2022
9
+
ms.date: 06/16/2022
10
10
11
11
ms.author: joflore
12
12
author: MicrosoftGuyJFlo
@@ -426,6 +426,27 @@ If you haven't deployed Windows Hello for Business and if that isn't an option f
426
426
427
427
Share your feedback about this feature or report issues using it on the [Azure AD feedback forum](https://feedback.azure.com/d365community/forum/22920db1-ad25-ec11-b6e6-000d3a4f0789).
428
428
429
+
### Missing application
430
+
431
+
If the Azure Windows VM Sign-In application is missing from Conditional Access, use the following steps to remediate the issue:
432
+
433
+
1. Check to make sure the application isn't in the tenant by:
434
+
1. Sign in to the **Azure portal**.
435
+
1. Browse to **Azure Active Directory** > **Enterprise applications**
436
+
1. Remove the filters to see all applications, and search for "VM". If you don't see Azure Windows VM Sign-In as a result, the service principal is missing from the tenant.
437
+
438
+
Another way to verify it is via Graph PowerShell:
439
+
440
+
1.[Install the Graph PowerShell SDK](/powershell/microsoftgraph/installation) if you haven't already done so.
1.`Get-MgServicePrincipal -ConsistencyLevel eventual -Search '"DisplayName:Azure Windows VM Sign-In"'`
445
+
1. If this command results in no output and returns you to the PowerShell prompt, you can create the Service Principal with the following Graph PowerShell command:
0 commit comments