PowerShell Credentials

Last modified: May 31, 2022
You are here:
Estimated reading time: 1 min

Setting Information

  • PowerShell
  • au2mator Service

Detailed Information

Here you can find detailed information on using our “ready to au2mate”  PowerShell Scripts

To make it easier for you to deploy, we use stored “Credentials” in our PowerShell Scripts.

The following list should help you see the “Credentials” we are using.

Credentials

 NameVariable for CredVariable for FileFilename
SMTP Credentials$SMTPcredential$SMTPcredential_FileSMTPCreds.xml
Teams Graph API$TeamsCred$TeamsCred_FileTeamsCreds.xml
Azure REST API$AzureRestAPICred$AzureRestAPICred_FileAzureRestCreds.xml
Azure Graph API$AzureADGraphAPICred$AzureADGraphAPICred_FileAzureADCreds.xml
Mail Graph API$AzureGraphMailCred$AzureGraphMailCred_FileAzureGraphMailCreds.xml

Run the following PowerShell command to store credentials in an XML File. Make sure you run the command as the Service User, configured at the IIS App Pool. Change the Path to fit your Credentials Store.

SMTP Credentials

Usage

Description

is used to send the Status Mail via SMTP

Create CRED File
$credential = Get-Credential
$credential | Export-CliXml -Path 'C:\TFS\PS-Services\CredentialStore\SMTPCreds.xml'

Teams Graph API

Usage
Description
  • It is used to send Teams Adaptive Cards via Graph API
Details

Create an Azure App Registration with the following “Delegated MS GRAPH API” Permissions

  • User.Read
  • User.ReadWrite
  • User.ReadBasic.All
  • User.Read.All
  • User.ReadWrite.All
  • GroupMember.Read.All
  • Directory.AccessAsUser.All
  • Channel.ReadBasic.All
  • ChannelSettings.Read.All
  • ChannelSettings.ReadWrite.All
  • Group.Read.All
  • Group.ReadWrite.All
  • Directory.Read.All
  • Directory.ReadWrite.All
  • ChannelMessage.Send
  • Chat.Create
  • Chat.ReadWrite
  • ChatMessage.Send
  • Chat.ReadWrite

Fill with your details. You need to create an Azure App Registration with appropriate Rights. See MS Documentations for Details

Graph API Documentation: Use the Microsoft Graph API to work with Microsoft Teams – Microsoft Graph v1.0 | Microsoft Docs

Azure App: Register your app with the Azure AD v2.0 endpoint – Microsoft Graph | Microsoft Docs

See this Post for Details: Use PowerShell with au2mator – au2mator – Self Service Portal

Create CRED File
[hashtable]$values = @{ }
$values.clientId = "a0000a00-0e0d-000e-aaaf-ed000b00df00"  
$values.clientSecret = "~V00gCE~aAUW-0oRd~I0LQYAof00r-r0z0"  
$values.tenantName = "tenant.onmicrosoft.com"
$values.User= "usernam@domain.com"
$values.PW = "yoursupperpassword"
$values| Export-CliXml -Path 'C:\TFS\PS-Services\CredentialStore\TeamsCreds.xml'

Azure REST API

Usage
Description
  • These credentials are used to make REST API Call and execute the Actions needed in our Scripts.
Details
  • Create an Azure App Reg
  • Add Azure App Reg the Contributor Role in your Subscription
Create CRED File
[hashtable]$values = @{ }
$values.clientId = "a0000a00-0e0d-000e-aaaf-ed000b00df00"  
$values.clientSecret = "V00gCE~aAUW-0oRd~I0LQYPJ4-vxg-2x3"  
$values.tenantID = "a0ba3ab6-fde5-0000-000d-e000c00dc000"
$values| Export-CliXml -Path 'C:\_SCOworkingDir\TFS\PS-Services\CredentialStore\AzureRestCreds.xml'

Something More

  • Since 3.4
Was this article helpful?
Dislike 0

Title