New-AzVM -ResourceGroupName "MyRG" -Name "MyVM" -Location "EastUS"
✅ Azure VM created successfully.
New-AzVM -ResourceGroupName "MyRG" -Name "MyVM" -Location "EastUS"
✅ Azure VM created successfully.
Joining laptops and desktops to Azure AD ensures centralized management, security compliance, and easier access to cloud resources. This guide covers both manual and PowerShell methods to join a Windows device to Azure AD.
Before proceeding, ensure the following: ✔ The device is running Windows 10 or later
✔ Internet connection is available
✔ You have Azure AD credentials with permissions
✔ Intune or Azure AD Join is enabled (for auto-enrollment)
✔ PowerShell script execution is allowed (for automation)
1️⃣ Open Settings → Accounts
2️⃣ Click Access work or school
3️⃣ Select Connect
4️⃣ Click Join this device to Azure Active Directory
5️⃣ Enter your Azure AD credentials ([email protected]
)
6️⃣ Click Next, verify details, and click Join
7️⃣ Restart the computer
✅ Done! The device is now part of Azure AD.
If you manage multiple devices, PowerShell can save a lot of time by automating the Azure AD join process.
powershellCopyEditGet-MDMEnrollmentStatus
📌 This command checks if the device is already joined.
Use the Add-Computer
command to join a machine to Azure AD.
powershellCopyEdit$AzureTenant = "jetmariano.us"
$User = "[email protected]"
dsregcmd /join /tenant $AzureTenant /UserName $User
📌 This command forces the device to join Azure AD.
powershellCopyEditdsregcmd /status
📌 The output should show AzureAdJoined : YES
If you’re using Intune for device management, configure Auto-Enrollment:
1️⃣ Go to Microsoft Endpoint Manager (Intune) → Devices
2️⃣ Navigate to Enroll devices
3️⃣ Enable Automatic Enrollment for Azure AD Joined devices
4️⃣ Assign User Groups
5️⃣ Click Save
✅ Now, all new devices will be auto-enrolled into Azure AD.
jetmariano.us
Method | When to Use | Command |
---|---|---|
Manual | Single device setup | Settings → Accounts → Work/School |
PowerShell | Multiple devices | dsregcmd /join |
Intune Auto-Join | Enterprise-wide auto-enrollment | Intune Enrollment |
✅ Your Windows devices are now joined to Azure AD!
Cross-Tenant Synchronization in Microsoft Entra ID (formerly Azure AD) allows automatic user provisioning between trusted organizations. However, synchronization may fail if incorrect identity configurations exist. In this guide, I’ll walk you through setting up Cross-Tenant Sync using PowerShell, ensuring all required configurations are properly applied.
Before proceeding, ensure:
Ensure you have the required module installed and connect to Microsoft Graph.
powershellCopyEditInstall-Module Microsoft.Graph -Scope CurrentUser
powershellCopyEditConnect-MgGraph -Scopes "User.ReadWrite.All", "Directory.ReadWrite.All", "Policy.ReadWrite.CrossTenantAccess"
After running this command, sign in with your Global Admin credentials.
Check your Cross-Tenant Access Policy to confirm if synchronization is enabled.
powershellCopyEditGet-MgPolicyCrossTenantAccessPolicy | Format-List
powershellCopyEditUpdate-MgPolicyCrossTenantAccessPolicy -DefaultInboundAccessEnabled $true -DefaultOutboundAccessEnabled $true
This command ensures that inbound and outbound sync is enabled.
If a user has Phone-based authentication (federated identity), Cross-Tenant Sync will fail. You must remove phone identities.
powershellCopyEditGet-MgUserAuthenticationMethod -UserId [email protected]
powershellCopyEditRemove-MgUserAuthenticationMethod -UserId [email protected] -AuthenticationMethodId phone
Replace [email protected] with the actual User Principal Name (UPN).
powershellCopyEditGet-MgUserAuthenticationMethod -UserId [email protected]
Ensure that “phone” is no longer listed.
Once identities are corrected, you can enable Cross-Tenant Sync.
powershellCopyEditNew-MgPolicyCrossTenantAccessPolicyConfigurationPartner -TenantId "<PartnerTenantID>" -InboundTrustType "ExternalAzureAD"
Replace <PartnerTenantID>
with the Tenant ID of the external organization.
powershellCopyEditSet-MgPolicyCrossTenantAccessPolicyConfigurationPartner -TenantId "<PartnerTenantID>" -AutomaticUserProvisioning $true
powershellCopyEditGet-MgPolicyCrossTenantAccessPolicyConfigurationPartner -TenantId "<PartnerTenantID>"
Once configured, test the sync to ensure users are provisioned correctly.
powershellCopyEditStart-ADSyncSyncCycle -PolicyType Delta
This forces an immediate Azure AD Sync to reflect recent changes.
If issues persist, check the Provisioning Logs in Azure AD Portal:
By following these steps, you can successfully set up Cross-Tenant Sync in Azure AD using PowerShell. Removing conflicting authentication methods like Phone-based authentication is critical for a seamless synchronization process.
If you have any questions or need further troubleshooting, drop a comment!
Cross-Tenant Synchronization in Microsoft Entra ID (formerly Azure AD) allows automatic user provisioning between trusted organizations. However, synchronization may fail if incorrect identity configurations exist. In this guide, I’ll walk you through setting up Cross-Tenant Sync using PowerShell, ensuring all required configurations are properly applied.
Before proceeding, ensure:
Ensure you have the required module installed and connect to Microsoft Graph.
powershellCopyEditInstall-Module Microsoft.Graph -Scope CurrentUser
powershellCopyEditConnect-MgGraph -Scopes "User.ReadWrite.All", "Directory.ReadWrite.All", "Policy.ReadWrite.CrossTenantAccess"
After running this command, sign in with your Global Admin credentials.
Check your Cross-Tenant Access Policy to confirm if synchronization is enabled.
powershellCopyEditGet-MgPolicyCrossTenantAccessPolicy | Format-List
powershellCopyEditUpdate-MgPolicyCrossTenantAccessPolicy -DefaultInboundAccessEnabled $true -DefaultOutboundAccessEnabled $true
This command ensures that inbound and outbound sync is enabled.
If a user has Phone-based authentication (federated identity), Cross-Tenant Sync will fail. You must remove phone identities.
powershellCopyEditGet-MgUserAuthenticationMethod -UserId [email protected]
powershellCopyEditRemove-MgUserAuthenticationMethod -UserId [email protected] -AuthenticationMethodId phone
Replace [email protected] with the actual User Principal Name (UPN).
powershellCopyEditGet-MgUserAuthenticationMethod -UserId [email protected]
Ensure that “phone” is no longer listed.
Once identities are corrected, you can enable Cross-Tenant Sync.
powershellCopyEditNew-MgPolicyCrossTenantAccessPolicyConfigurationPartner -TenantId "<PartnerTenantID>" -InboundTrustType "ExternalAzureAD"
Replace <PartnerTenantID>
with the Tenant ID of the external organization.
powershellCopyEditSet-MgPolicyCrossTenantAccessPolicyConfigurationPartner -TenantId "<PartnerTenantID>" -AutomaticUserProvisioning $true
powershellCopyEditGet-MgPolicyCrossTenantAccessPolicyConfigurationPartner -TenantId "<PartnerTenantID>"
Once configured, test the sync to ensure users are provisioned correctly.
powershellCopyEditStart-ADSyncSyncCycle -PolicyType Delta
This forces an immediate Azure AD Sync to reflect recent changes.
If issues persist, check the Provisioning Logs in Azure AD Portal:
By following these steps, you can successfully set up Cross-Tenant Sync in Azure AD using PowerShell. Removing conflicting authentication methods like Phone-based authentication is critical for a seamless synchronization process.
If you have any questions or need further troubleshooting, drop a comment!
While configuring Azure AD Cross-Tenant Synchronization, you may encounter an issue where the synchronization process fails due to incorrect identity types assigned to user accounts. In my case, the identity type was set to phone instead of the recommended authentication method, preventing successful synchronization.
After troubleshooting with Microsoft engineers, it was identified that Cross-Tenant Sync does not work when a phone-based identity is assigned to a user. The issue arises because federated identities using phone-based authentication do not support synchronization across tenants.
As shown in the screenshots, my user identity in Azure AD > Users > Identities was set to phone under the “Sign-in type” column. This configuration blocked the user from syncing successfully between tenants.
To resolve this issue, follow these steps: