[ad_1]
Do you need to hook up with your AzAccount or Azure subscription however will not be positive what cmdlet to make use of? You want the Join-AzAccount cmdlet, and this information teaches you all about this cmdlet.
By Victor Ashiedu | Up to date February 17, 2023 | 7 minutes learn
To make this text simple to learn, I’ve divided them into sections, beginning with an outline of this cmdlet. Furthermore, earlier than you should use the Join-AzAccount cmdlet, it’s good to set up the Az.Accounts PowerShell module.
So, within the second part, I’ll present you the best way to set up the Az.Accounts PowerShell module. After you have this module in your pc, you’ll be able to proceed to learn the syntaxes and parameters of the Join-AzAccount cmdlet.
Then comes the thrilling bit in part 4 – examples and functions of this cmdlet. Lastly, I included an FAQ part the place I reply frequent questions SysAdmins ask about this Azure PowerShell cmdlet.
Overview of the Join-AzAccount Cmdlet
As I hinted in my introduction, the Join-AzAccount cmdlet is a part of the Az.Accounts PowerShell module. So, in case you attempt to run this command with out putting in this module, you’ll obtain an error message – see the screenshot beneath.
In the meantime, this cmdlet connects you to an Azure tenant with an authenticated account. When you hook up with Azure with the Join-AzAccount cmdlet, you should use the opposite cmdlets within the Az PowerShell module.
Within the final paragraph, I discussed that you simply want an authenticated account to make use of Join-AzAccount to hook up with Azure. Primarily based on this, it is strongly recommended to make use of the Get-Credential command to save lots of your authenticated credentials in a variable.
Then, use the -Credential parameter of the Join-AzAccount cmdlet to hook up with your Azure tenant.
Earlier than I transfer on from this overview part, I’ll additionally like to say that the Join-AzAccount cmdlet has two different aliases – Login-AzAccount and Add-AzAccount. So because of this you should use Login-AzAccount or Add-AzAccount as a substitute of Join-AzAccount.
With the fundamentals out of the way in which, let’s now transfer on to the juicy components of this text!
The right way to Set up the Az.Accounts PowerShell Module
I’ve already talked about greater than as soon as on this article that it’s good to set up the Az.Accounts PowerShell module earlier than you should use the Join-AzAccount cmdlet.
Comply with the steps beneath to put in the Az.Accounts PowerShell module.
- Seach PowerShell. Then, from the search outcomes, click on Run as Administrator. Your Home windows PC will ask you to permit the app to make modifications to your PC – click on Sure.
- Then, when PowerShell opens, copy and paste the command beneath. Then, press the enter key in your keyboard to run the command.
Set up-Module -Identify Az.Accounts -Pressure
When PowerShell finishes putting in the module, while you run the Join-AzAccount command, PowerShell will immediate you on your credentials.
Nonetheless, earlier than we begin enjoying round with this cmdlet, let’s be taught its syntaxes and parameters first. I’ll cowl these within the subsequent two sections.
Earlier I discussed that the Join-AzAccount cmdlet has two different aliases – Login-AzAccount and Add-AzAccount. Now that you’ve put in the Az.Accounts module, you’ll be able to run the command beneath to substantiate that Login-AzAccount and Add-AzAccount are the aliases of Join-AzAccount.
Get-Alias | ? {$_.Identify -like "*AzAccount*"} | Choose-Object title, ReferencedCommand
Right here is the screenshot of the results of the command. I’ve highlighted the a part of the outcome that exhibits that Login-AzAccount and Add-AzAccount are the aliases of Join-AzAccount.
Syntaxes of the Join-AzAccount Cmdlet
The Join-AzAccount cmdlet has 8 syntaxes. Right here they’re…
I perceive that trying on the 8 syntaxes presents an issue. Particularly, it’s obscure the variations between the syntaxes. So, after the syntaxes, I’ve supplied a quick clarification of what differentiates the syntaxes.
Join-AzAccount [-Environment <String>] [-Tenant <String>] [-AccountId <String>] [-Subscription <String>] [-AuthScope <String>] [-ContextName <String>] [-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-UseDeviceAuthentication] [-Force] [-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Join-AzAccount [-Environment <String>] -Credential <PSCredential> [-ServicePrincipal] -Tenant <String> [-Subscription <String>] [-AuthScope <String>] [-ContextName <String>] [-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-Force] [-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Join-AzAccount [-Environment <String>] -Credential <PSCredential> [-Tenant <String>] [-Subscription <String>] [-AuthScope <String>] [-ContextName <String>] [-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-Force] [-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Join-AzAccount [-Environment <String>] -CertificateThumbprint <String> -ApplicationId <String> [-ServicePrincipal] -Tenant <String> [-Subscription <String>] [-AuthScope <String>] [-ContextName <String>] [-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-Force] [-SendCertificateChain] [-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Join-AzAccount [-Environment <String>] -ApplicationId <String> [-ServicePrincipal] -Tenant <String> [-Subscription <String>] [-ContextName <String>] [-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-Force] -FederatedToken <String> [-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Join-AzAccount [-Environment <String>] -ApplicationId <String> [-ServicePrincipal] -Tenant <String> [-Subscription <String>] [-ContextName <String>] [-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-Force] [-SendCertificateChain] -CertificatePath <String> [-CertificatePassword <SecureString>] [-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Join-AzAccount [-Environment <String>] [-Tenant <String>] -AccessToken <String> [-GraphAccessToken <String>] [-MicrosoftGraphAccessToken <String>] [-KeyVaultAccessToken <String>] -AccountId <String> [-Subscription <String>] [-ContextName <String>] [-SkipValidation] [-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-Force] [-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Join-AzAccount [-Environment <String>] [-Tenant <String>] [-AccountId <String>] [-Identity] [-Subscription <String>] [-AuthScope <String>] [-ContextName <String>] [-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-Force] [-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Parameters of the Join-AzAccount Cmdlet Defined
Within the final part, I listed and defined the 8 syntaxes of the Join-AzAccount cmdlet. Within the desk beneath, I’ve defined the parameters that make up the syntaxes of 6he command.
Join-AzAccount Parameter Identify | Parameter That means/Notes |
---|---|
Atmosphere | The Atmosphere parameter specifies the setting of the Azure account. |
Tenant | Use the Tenant parameter to specify the ID or title of the Azure Tenant you want to hook up with. |
AccountId | While you specify the AccountId parameter, enter the Azure Account Id, Consumer Id, or the Consumer Identify of the account you need to register with. |
Subscription | Use this parameter to specify the Azure Subscription |
AuthScope | This parameter specifies an optionally available OAuth scope for login. The AuthScope parameter of the Join-AzAccount cmdlet accepts any of the next: AadGraph, AnalysisServices, Attestation, Batch, DataLake, KeyVault, OperationalInsights, Storage, Synapse. |
ContextName | Use the ContextName parameter to specify the title of the default Azure context for the present login with Join-AzAccount. |
SkipContextPopulation | It is a SwitchParameter, which implies that it doesn’t require any enter. While you specify the SkipContextPopulation parameter, Join-AzAccount skips populating context if no contexts are discovered. |
References and Additional Studying
- PowerShell Gallery | Az.Accounts 2.2.3
- Join-AzAccount (Az.Accounts) | Microsoft Study
- Join-AzAccount: Your Gateway To Azure with PowerShell (adamtheautomator.com)
[ad_2]
Source link