简体   繁体   中英

Error when global variable in Orchestrator 2012 is encrypted

I'm trying to use some credentials so I can connect to MicrosoftTeams using powershell with orchestrator. I need a username and its password. The password is stored as a global variable, encrypted. When I try to connect to MicrosoftTeams it says that the password is incorrent. However, when I put the password hard coded there is no problem, and I can connect to Microsoft Teams. Here is my code:

   $Pass = ConvertTo-SecureString '{password}' -AsPlainText -Force 
   $admin ="admin@admin.com"
   $cred = new-object -typename System.Management.Automation.PSCredential -argumentList $admin, $password

  connect-MicrosoftTeams -credential $cred

Has someone had the same issue?

I think my problem was because I was using a PowerShell Script activity. It turns out that this activity can't read encrypted variables. To solve this problem I just enctypted the password and stored it in my C: drive, then I just got the content from that file. If someone wants the code for that, please ask.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM