To add an Azure user to local admin for secure access, you'll need to use the Azure Active Directory (Azure AD) module for PowerShell. This module allows you to manage Azure AD and connect to Azure resources.
You can download the Azure AD module from the PowerShell Gallery, but first, you need to install the Azure PowerShell module. This will give you access to the necessary cmdlets to manage Azure resources.
To connect to Azure using PowerShell, you'll need to provide your Azure subscription ID, tenant ID, and a credential object. This can be done by running the Connect-AzAccount cmdlet and following the prompts to sign in with your Azure account.
Once connected, you can use the Get-AzSubscription cmdlet to retrieve a list of your Azure subscriptions and the Get-AzADUser cmdlet to retrieve a list of Azure AD users.
Azure AD Integration
Azure AD allows you to define local administrators at the device level, but this is a global setting. You can't handle it at the device level without logging in from an account that already has local administrator rights.
To enable local administrators on Azure AD joined devices, go to Azure Active Directory and Devices, and click on the "Additional local administrators on Azure AD joined devices" setting. By default, it's set to None, so click on the "Selected" tab to enable it.
Azure AD adds the following security principles to the local administrators group on the device: Azure AD global administrator role, Azure AD device administrator role, and the user performing the Azure AD join.
To add a user to the local administrators group, you need to sign in at least once. After that, you can use the command "net localgroup administrators /add "AzureAD\UserUpn"" to add the user.
You can also use PowerShell scripts or CSPs from Intune to add users to the local admin group. However, you can't assign groups to the device administrator role, only individual users are allowed.
Device administrators are assigned to all Azure AD Joined devices and can't be scoped to a specific set of devices. When you remove users from the device administrator role, they still have local administrator privilege on a device as long as they are signed in to it, until the next sign-in or after 4 hours when a new primary refresh token is issued.
Here's a summary of the roles that are automatically added to the local administrators group on an Azure AD joined device:
- Azure AD global administrator role
- Azure AD device administrator role
- The user performing the Azure AD join
Prerequisites
To add an Azure user to local admin, you'll need to have the Azure Active Directory (Azure AD) module for PowerShell installed on your machine. This module is required for authenticating with Azure AD.
You should also have a subscription to Azure, as well as an Azure AD tenant. This is necessary for creating and managing users in Azure AD.
Your Azure AD tenant should be connected to your local Active Directory, which will allow you to synchronize users and groups between the two. This connection is established using Azure AD Connect.
You should have the necessary permissions to install and configure Azure AD Connect, as well as to manage users in Azure AD. This may require administrative privileges on your local machine.
Frequently Asked Questions
How do I add ad users to a local admin group in powershell?
To add AD users to a local admin group in PowerShell, use the command `Add-LocalGroupMember -Group "Administrators" -Member "domain\user or group," "additional users or groups."` Follow the syntax for a seamless addition.
Sources
- https://stackoverflow.com/questions/53601965/additional-local-administrators-on-azure-ad-joined-devices-is-not-allowing-users
- https://www.mobile-mentor.com/insights/azure-ad-local-administrator-access-how-to-options/
- https://www.rebeladmin.com/step-step-guide-add-additional-local-administrators-azure-ad-joined-devices/
- https://www.richardawilson.com/2010/06/add-user-as-local-administrator-on.html
- https://eskonr.com/2019/10/how-to-add-users-to-local-administrators-group-on-azure-ad-joined-devices/
Featured Images: pexels.com