Skip to content

Commit 7fc05a2

Browse files
authored
Merge pull request #202128 from SanDeo-MSFT/patch-104
Update howto-vm-sign-in-azure-ad-linux.md
2 parents 4f1ac89 + a9da94b commit 7fc05a2

File tree

1 file changed

+17
-37
lines changed

1 file changed

+17
-37
lines changed

articles/active-directory/devices/howto-vm-sign-in-azure-ad-linux.md

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services: active-directory
66
ms.service: active-directory
77
ms.subservice: devices
88
ms.topic: how-to
9-
ms.date: 06/16/2022
9+
ms.date: 06/20/2022
1010

1111
ms.author: joflore
1212
author: MicrosoftGuyJFlo
@@ -39,12 +39,13 @@ The following Linux distributions are currently supported during the preview of
3939

4040
| Distribution | Version |
4141
| --- | --- |
42+
| Common Base Linux Mariner (CBL-Mariner) | CBL-Mariner 1, CBL-Mariner 2 |
4243
| CentOS | CentOS 7, CentOS 8 |
43-
| Debian | Debian 9, Debian 10 |
44+
| Debian | Debian 9, Debian 10, Debian 11 |
4445
| openSUSE | openSUSE Leap 42.3, openSUSE Leap 15.1+ |
4546
| RedHat Enterprise Linux (RHEL) | RHEL 7.4 to RHEL 7.10, RHEL 8.3+ |
4647
| SUSE Linux Enterprise Server (SLES) | SLES 12, SLES 15.1+ |
47-
| Ubuntu Server | Ubuntu Server 16.04 to Ubuntu Server 20.04 |
48+
| Ubuntu Server | Ubuntu Server 16.04 to Ubuntu Server 22.04 |
4849

4950
The following Azure regions are currently supported for this feature:
5051

@@ -99,17 +100,17 @@ Ensure your VM is configured with the following functionality:
99100

100101
Ensure your client meets the following requirements:
101102

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.
103+
- 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.
104+
- 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.
105+
- 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.
105106
- 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).
106107

107108
> [!IMPORTANT]
108109
> SSH clients based on PuTTy do not support openSSH certificates and cannot be used to login with Azure AD openSSH certificate-based authentication.
109110
110111
## Enabling Azure AD login in for Linux VM in Azure
111112

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+
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:
113114

114115
- Azure portal experience when creating a Linux VM
115116
- Azure Cloud Shell experience when creating a Windows VM or for an existing Linux VM
@@ -224,11 +225,11 @@ az role assignment create \
224225
225226
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).
226227

227-
## Install SSH extension for Azure CLI
228+
## Install SSH extension for Az CLI
228229

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+
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.
230231

231-
Run the following command to add SSH extension for Azure CLI
232+
Run the following command to add SSH extension for Az CLI
232233

233234
```azurecli
234235
az extension add --name ssh
@@ -245,11 +246,11 @@ az extension show --name ssh
245246
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".
246247

247248
> [!NOTE]
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+
> 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.
249250
250251
## Login using Azure AD user account to SSH into the Linux VM
251252

252-
### Using Azure CLI
253+
### Using Az CLI
253254

254255
First do az login and then az ssh vm.
255256

@@ -265,7 +266,7 @@ The following example automatically resolves the appropriate IP address for the
265266
az ssh vm -n myVM -g AzureADLinuxVM
266267
```
267268

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+
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.
269270

270271
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.
271272

@@ -308,7 +309,7 @@ Use the following example to authenticate to Azure CLI using the service princip
308309
az login --service-principal -u <sp-app-id> -p <password-or-cert> --tenant <tenant-id>
309310
```
310311

311-
Once authentication with a service principal is complete, use the normal Azure CLI SSH commands to connect to the VM.
312+
Once authentication with a service principal is complete, use the normal Az CLI SSH commands to connect to the VM.
312313

313314
```azurecli
314315
az ssh vm -n myVM -g AzureADLinuxVM
@@ -389,33 +390,12 @@ For customers who are using previous version of Azure AD login for Linux that wa
389390
390391
## Using Azure Policy to ensure standards and assess compliance
391392
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+
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).
393394
394395
## Troubleshoot sign-in issues
395396
396397
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.
397398
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.
410-
1. `Connect-MgGraph -Scopes "ServicePrincipalEndpoint.ReadWrite.All","Application.ReadWrite.All"`
411-
1. Sign-in with a Global Admin account
412-
1. Consent to permission prompt
413-
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:
415-
1. `New-MgServicePrincipal -AppId ce6ff14a-7fdc-4685-bbe0-f6afdfcfa8e0`
416-
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-
419399
### Couldn’t retrieve token from local cache
420400
421401
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).
@@ -489,7 +469,7 @@ Virtual machine scale set VM connections may fail if the virtual machine scale s
489469
490470
### AllowGroups / DenyGroups statements in sshd_config cause first login to fail for Azure AD users
491471
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+
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.
493473
494474
Solution 1: Remove AllowGroups and DenyGroups statements from sshd_config.
495475

0 commit comments

Comments
 (0)