[英]How to connect PowerShell with CRM online?
I am writing a PowerShell script where it needs to be connected to CRM online.我正在编写一个 PowerShell 脚本,它需要在线连接到 CRM。
I can connect to CRM using Connect-CrmOnline
where it asks for credentials using a login box.我可以使用
Connect-CrmOnline
连接到 CRM,它使用登录框要求提供凭据。 I want to automate it.我想自动化它。 Please guide on how to do it.
请指导如何做。
Is there a way to connect using connection string?有没有办法使用连接字符串进行连接? Please share sample code/ script.
请分享示例代码/脚本。 I am new to PowerShell.
我是 PowerShell 的新手。
I am using Microsoft.Xrm.Data.PowerShell
我正在使用
Microsoft.Xrm.Data.PowerShell
Thank you.谢谢你。
You can build a credentials object and use that in the script.您可以构建凭证对象并在脚本中使用它。 For example:
例如:
$secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
You would then use it within your script with -credential $mycreds
parameter然后,您可以在脚本中使用
-credential $mycreds
参数使用它
Ref: https://blogs.msdn.microsoft.com/koteshb/2010/02/12/powershell-how-to-create-a-pscredential-object/ and https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/xrm-tooling/use-powershell-cmdlets-xrm-tooling-connect参考: https : //blogs.msdn.microsoft.com/koteshb/2010/02/12/powershell-how-to-create-a-pscredential-object/和https://docs.microsoft.com/en-us /dynamics365/customer-engagement/developer/xrm-tooling/use-powershell-cmdlets-xrm-tooling-connect
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.