AzureServicePrincipalAccount.psm1-Help.TempPoint.xml
<?xml version="1.0" encoding="utf-8"?>
<helpItems xmlns="http://msh" schema="maml"> <!--Edited with: SAPIEN PowerShell HelpWriter 2017 v2.1.36--> <!--Generated by: SAPIEN PowerShell HelpWriter 2017 v2.1.36--> <!-- Module: AzureServicePrincipalAccount Version: 0.0.1 --> <!--All Commands--> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <!--TAG: HASCOMMONPARAMETERS--> <!--Command--> <command:details> <command:name>Add-AzureRMServicePrincipalAccount</command:name> <maml:description> <maml:para></maml:para> </maml:description> <maml:copyright> <maml:para></maml:para> </maml:copyright> <command:verb>Add</command:verb> <command:noun>AzureRMServicePrincipalAccount</command:noun> <dev:version /> </command:details> <maml:description> <maml:para></maml:para> </maml:description> <command:syntax> <!--Parameter Sets--> <command:syntaxItem parametersetname="BySPConnection"> <!--NAME: BySPConnection--> <maml:name>Add-AzureRMServicePrincipalAccount</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AzureServicePrincipalConnection</maml:name> <maml:description> <maml:para>The Azure Automation connection object for the Azure AD Service Principal. The connection type must be either the built-in type of "AzureServicePrincipal" or the "AzureServicePrincipal-KeyBased" type which is defined in this module</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type> <maml:name>Object</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem parametersetname="BySPCert"> <!--NAME: BySPCert--> <maml:name>Add-AzureRMServicePrincipalAccount</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="AppId"> <maml:name>ApplicationId</maml:name> <maml:description> <maml:para>Azure AD Application ID</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type> <maml:name>Object</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Tenant"> <maml:name>TenantId</maml:name> <maml:description> <maml:para>Azure AD Tenant ID</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Subscription"> <maml:name>SubscriptionId</maml:name> <maml:description> <maml:para>Azure Subscription ID</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="env"> <maml:name>Environment</maml:name> <maml:description> <maml:para>Azure Environment</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>AzureCloud</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Thumbprint"> <maml:name>CertThumbprint</maml:name> <maml:description> <maml:para>Azure AD Service Principal certificate thumbprint</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem parametersetname="BySPKey"> <!--NAME: BySPKey--> <maml:name>Add-AzureRMServicePrincipalAccount</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="AppId"> <maml:name>ApplicationId</maml:name> <maml:description> <maml:para>Azure AD Application ID</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type> <maml:name>Object</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Tenant"> <maml:name>TenantId</maml:name> <maml:description> <maml:para>Azure AD Tenant ID</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Subscription"> <maml:name>SubscriptionId</maml:name> <maml:description> <maml:para>Azure Subscription ID</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="env"> <maml:name>Environment</maml:name> <maml:description> <maml:para>Azure Environment</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>AzureCloud</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Password"> <maml:name>ServicePrincipalKey</maml:name> <maml:description> <maml:para>Azure AD Service Principal key (password)</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SecureString</command:parameterValue> <dev:type> <maml:name>SecureString</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <!--All Parameters--> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named"> <maml:name>AzureServicePrincipalConnection</maml:name> <maml:description> <maml:para>The Azure Automation connection object for the Azure AD Service Principal. The connection type must be either the built-in type of "AzureServicePrincipal" or the "AzureServicePrincipal-KeyBased" type which is defined in this module</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type> <maml:name>Object</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="AppId"> <maml:name>ApplicationId</maml:name> <maml:description> <maml:para>Azure AD Application ID</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type> <maml:name>Object</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Tenant"> <maml:name>TenantId</maml:name> <maml:description> <maml:para>Azure AD Tenant ID</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Subscription"> <maml:name>SubscriptionId</maml:name> <maml:description> <maml:para>Azure Subscription ID</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="env"> <maml:name>Environment</maml:name> <maml:description> <maml:para>Azure Environment</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>AzureCloud</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Thumbprint"> <maml:name>CertThumbprint</maml:name> <maml:description> <maml:para>Azure AD Service Principal certificate thumbprint</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Password"> <maml:name>ServicePrincipalKey</maml:name> <maml:description> <maml:para>Azure AD Service Principal key (password)</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SecureString</command:parameterValue> <dev:type> <maml:name>SecureString</maml:name> <maml:uri /> </dev:type> <dev:defaultValue></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <!--Inputs--> <command:inputType> <dev:type> <maml:name>None </maml:name> <maml:uri></maml:uri> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <!--Outputs--> <command:returnValue> <dev:type> <maml:name>PSAzureProfile</maml:name> <maml:uri></maml:uri> </dev:type> <maml:description> <maml:para /> </maml:description> </command:returnValue> </command:returnValues> <command:examples> <!--Examples--> <command:example> <maml:title>--------EXAMPLE 1--------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>$KeyBasedConnection = Get-AutomationConnection 'KeyBasedConnectionName' Add-AzureRMServicePrincipalAccount -AzureServicePrincipalConnection $KeyBasedConnection</dev:code> <dev:remarks> <maml:para>Sign in to Azure using a key-based service principal connection object</maml:para> </dev:remarks> </command:example> <command:example xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:title xmlns:maml="http://schemas.microsoft.com/maml/2004/10">--------EXAMPLE 2--------</maml:title> <maml:introduction xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">$CertBasedConnection = Get-AutomationConnection 'CertBasedConnectionName' Add-AzureRMServicePrincipalAccount -AzureServicePrincipalConnection $CertBasedConnection</dev:code> <dev:remarks xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:para>Sign in to Azure using a Certificate-based service principal connection object</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--------EXAMPLE 3--------</maml:title> <maml:introduction> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code>$ServicePrincipalKey = ConvertTo-SecureString -String 'password1234'-AsPlainText -Force Add-AzureRMServicePrincipalAccount -ApplicationId $ApplicationId -TenantId $TenantId -SubscriptionId $SubscriptionId -ServicePrincipalKey $ServicePrincipalKey </dev:code> <dev:remarks> <maml:para>Sign in to Azure using a key-based service principal by specifying individual parameters</maml:para> </dev:remarks> </command:example> <command:example xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:title xmlns:maml="http://schemas.microsoft.com/maml/2004/10">--------EXAMPLE 4--------</maml:title> <maml:introduction xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">$CertThumbprint = '073691B279C78A6C411F70DEE763DE322B547F67' Add-AzureRMServicePrincipalAccount -ApplicationId $ApplicationId -TenantId $TenantId -SubscriptionId $SubscriptionId -CertThumbprint $CertThumbprint </dev:code> <dev:remarks xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:para>Sign in to Azure using a certificate-based service principal by specifying individual parameters</maml:para> </dev:remarks> </command:example> </command:examples> </command:command> <!--Generated by: SAPIEN PowerShell HelpWriter 2017 v2.1.36--> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <!--TAG: HASCOMMONPARAMETERS--> <!--Command--> <command:details> <command:name>Get-AzureADToken</command:name> <maml:description> <maml:para /> </maml:description> <maml:copyright> <maml:para /> </maml:copyright> <command:verb>Get</command:verb> <command:noun>AzureADToken</command:noun> <dev:version /> </command:details> <maml:description> <maml:para /> </maml:description> <command:syntax> <!--Parameter Sets--> <command:syntaxItem parametersetname="BySPConnection"> <!--NAME: BySPConnection--> <maml:name>Get-AzureADToken</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">AzureServicePrincipalConnection</maml:name> <maml:description xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>The Azure Automation connection object for the Azure AD Service Principal. The connection type must be either the built-in type of "AzureServicePrincipal" or the "AzureServicePrincipal-KeyBased" type which is defined in this module</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">Object</maml:name> <maml:uri xmlns:maml="http://schemas.microsoft.com/maml/2004/10" /> </dev:type> <dev:defaultValue xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"></dev:defaultValue> </command:parameter> <command:parameter required="false" globbing="false" pipelineInput="false" variableLength="false" position="named"> <maml:name>OAuthURI</maml:name> <maml:description> <maml:para>The URI for requesting oAuth token. if not specified, the default value is "https://login.microsoftonline.com/$TenantId/oauth2/token"</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false" /> <dev:defaultValue /> </command:parameter> <command:parameter required="false" globbing="false" pipelineInput="false" variableLength="false" position="named"> <maml:name>ResourceURI</maml:name> <maml:description> <maml:para>The Resource URI for where the oAuth token will be consumed.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false" /> <dev:defaultValue>https://management.azure.com/</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem parametersetname="ByCred"> <!--NAME: ByCred--> <maml:name>Get-AzureADToken</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Tenant" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">TenantId</maml:name> <maml:description xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>Azure AD Tenant ID</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">String</maml:name> <maml:uri xmlns:maml="http://schemas.microsoft.com/maml/2004/10" /> </dev:type> <dev:defaultValue xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"></dev:defaultValue> </command:parameter> <command:parameter required="false" globbing="false" pipelineInput="false" variableLength="false" position="named"> <maml:name>OAuthURI</maml:name> <maml:description> <maml:para>The URI for requesting oAuth token. if not specified, the default value is "https://login.microsoftonline.com/$TenantId/oauth2/token"</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false" /> <dev:defaultValue /> </command:parameter> <command:parameter required="false" globbing="false" pipelineInput="false" variableLength="false" position="named"> <maml:name>ResourceURI</maml:name> <maml:description> <maml:para>The Resource URI for where the oAuth token will be consumed.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false" /> <dev:defaultValue>https://management.azure.com/</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Cred" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">Credential</maml:name> <maml:description xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>Azure AD Credential. When using a key-based Service Principal, the username of the credential object should be the Azure AD Application ID and the password should be the service principal key</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">Object</maml:name> <maml:uri xmlns:maml="http://schemas.microsoft.com/maml/2004/10" /> </dev:type> <dev:defaultValue xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"></dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem parametersetname="UserInteractive"> <!--NAME: UserInteractive--> <maml:name>Get-AzureADToken</maml:name> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Tenant" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">TenantId</maml:name> <maml:description xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>Azure AD Tenant ID</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">String</maml:name> <maml:uri xmlns:maml="http://schemas.microsoft.com/maml/2004/10" /> </dev:type> <dev:defaultValue xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"></dev:defaultValue> </command:parameter> <command:parameter required="false" globbing="false" pipelineInput="false" variableLength="false" position="named"> <maml:name>OAuthURI</maml:name> <maml:description> <maml:para>The URI for requesting oAuth token. if not specified, the default value is "https://login.microsoftonline.com/$TenantId/oauth2/token"</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false" /> <dev:defaultValue /> </command:parameter> <command:parameter required="false" globbing="false" pipelineInput="false" variableLength="false" position="named"> <maml:name>ResourceURI</maml:name> <maml:description> <maml:para>The Resource URI for where the oAuth token will be consumed.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false" /> <dev:defaultValue>https://management.azure.com/</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <!--All Parameters--> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">AzureServicePrincipalConnection</maml:name> <maml:description xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>The Azure Automation connection object for the Azure AD Service Principal. The connection type must be either the built-in type of "AzureServicePrincipal" or the "AzureServicePrincipal-KeyBased" type which is defined in this module</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object</command:parameterValue> <dev:type xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">Object</maml:name> <maml:uri xmlns:maml="http://schemas.microsoft.com/maml/2004/10" /> </dev:type> <dev:defaultValue xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"></dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Tenant" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">TenantId</maml:name> <maml:description xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>Azure AD Tenant ID</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">String</maml:name> <maml:uri xmlns:maml="http://schemas.microsoft.com/maml/2004/10" /> </dev:type> <dev:defaultValue xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"></dev:defaultValue> </command:parameter> <command:parameter required="false" globbing="false" pipelineInput="false" variableLength="false" position="named"> <maml:name>OAuthURI</maml:name> <maml:description> <maml:para>The URI for requesting oAuth token. if not specified, the default value is "https://login.microsoftonline.com/$TenantId/oauth2/token"</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false" /> <dev:defaultValue /> </command:parameter> <command:parameter required="false" globbing="false" pipelineInput="false" variableLength="false" position="named"> <maml:name>ResourceURI</maml:name> <maml:description> <maml:para>The Resource URI for where the oAuth token will be consumed.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false" /> <dev:defaultValue>https://management.azure.com/</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="Cred" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">Credential</maml:name> <maml:description xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>Azure AD Credential. When using a key-based Service Principal, the username of the credential object should be the Azure AD Application ID and the password should be the service principal key</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:name xmlns:maml="http://schemas.microsoft.com/maml/2004/10">Object</maml:name> <maml:uri xmlns:maml="http://schemas.microsoft.com/maml/2004/10" /> </dev:type> <dev:defaultValue xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"></dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <!--Inputs--> <command:inputType> <dev:type> <maml:name>None</maml:name> <maml:uri /> </dev:type> <maml:description> <maml:para /> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <!--Outputs--> <command:returnValue> <dev:type> <maml:name>String</maml:name> <maml:uri></maml:uri> </dev:type> <maml:description> <maml:para>Azure AD oAuth token</maml:para> </maml:description> </command:returnValue> </command:returnValues> <command:examples> <!--Examples--> <command:example xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:title xmlns:maml="http://schemas.microsoft.com/maml/2004/10">--------EXAMPLE 1--------</maml:title> <maml:introduction xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">$KeyBasedConnection = Get-AutomationConnection 'KeyBasedConnectionName' $Token = Get-AzureADToken -AzureServicePrincipalConnection $KeyBasedConnection $Token</dev:code> <dev:remarks xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:para>Generate an oAuth token to access ARM rest API (https://management.azure.com) using a key-based service principal connection object</maml:para> </dev:remarks> </command:example> <command:example xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:title xmlns:maml="http://schemas.microsoft.com/maml/2004/10">--------EXAMPLE 2--------</maml:title> <maml:introduction xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">$ServicePrincipalKey = ConvertTo-SecureString -String 'password1234'-AsPlainText -Force $AzureADCred = New-Object System.Mangement.Automation.PSCredential($ApplicationId, $ServicePrincipalKey) $Token = Get-AzureADToken -Credential $AzureADCred -TenantId $TenantId -ServicePrincipalKey $ServicePrincipalKey $Token</dev:code> <dev:remarks xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:para>Generate an oAuth token to access ARM rest API (https://management.azure.com) using a key-based service principal by specifying individual parameters</maml:para> </dev:remarks> </command:example> <command:example xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:title xmlns:maml="http://schemas.microsoft.com/maml/2004/10">--------EXAMPLE 3--------</maml:title> <maml:introduction xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">#Get Key Vault oAuth URI $vaultName = 'MyKeyVaultName' $GetKVoAuthURIResponse = try { Invoke-RestMethod -Method GET -Uri "https://$vaultName.vault.azure.net/keys" -Headers @{} } catch { $_.Exception.Response } $authHeader = $GetKVoAuthURIResponse .Headers['www-authenticate'] $endpoint = [regex]::match($authHeader, 'authorization="(.*?)"').Groups[1].Value $KeyVaultOAuth2Uri = "$endpoint/oauth2/token" $KeyBasedConnection = Get-AutomationConnection 'KeyBasedConnectionName' $Token = Get-AzureADToken -AzureServicePrincipalConnection $KeyBasedConnection -OAuthURI $KeyVaultOAuth2Uri -ResourceURI 'https://vault.azure.net' $Token</dev:code> <dev:remarks xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:para>Generate an oAuth token to access Azure Key vault REST API (https://vault.azure.net) using a key-based service principal connection object</maml:para> </dev:remarks> </command:example> <command:example xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:title xmlns:maml="http://schemas.microsoft.com/maml/2004/10">--------EXAMPLE 4--------</maml:title> <maml:introduction xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">$username = 'you@contoso.onmicrosoft.com' $password= ConvertTo-SecureString -String 'password1234'-AsPlainText -Force $AzureADCred = New-Object System.Mangement.Automation.PSCredential($username, $password) $Token = Get-AzureADToken -Credential $AzureADCred -TenantId $TenantId -Credential $AzureADCred $Token </dev:code> <dev:remarks xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:para>Generate an oAuth token to access ARM rest API (https://management.azure.com) using a Azure AD User Principal</maml:para> </dev:remarks> </command:example> <command:example xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:title xmlns:maml="http://schemas.microsoft.com/maml/2004/10">--------EXAMPLE 5--------</maml:title> <maml:introduction xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">$Token = Get-AzureADToken -Credential $AzureADCred -TenantId $TenantId $Token</dev:code> <dev:remarks xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:para>Generate an oAuth token to access ARM rest API (https://management.azure.com) using a Azure AD User Principal (by prompting entering user name and password). This method supports user accounts with MFA enabled.</maml:para> </dev:remarks> </command:example> <command:example xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"> <maml:title xmlns:maml="http://schemas.microsoft.com/maml/2004/10">--------EXAMPLE 6--------</maml:title> <maml:introduction xmlns:maml="http://schemas.microsoft.com/maml/2004/10"> <maml:para>C:\PS></maml:para> </maml:introduction> <dev:code xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">$Token = Get-AzureADToken -Credential $AzureADCred -TenantId $TenantId -ResourceURI 'https://graph.windows.net' $Token</dev:code> <dev:remarks xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10"> <maml:para>Generate an oAuth token to access Microsoft Graph API (https://graph.windows.net) using a Azure AD User Principal (by prompting entering user name and password). This method supports user accounts with MFA enabled.</maml:para> </dev:remarks> </command:example> </command:examples> </command:command> <!--Edited with: SAPIEN PowerShell HelpWriter 2017 v2.1.36--> </helpItems> |