gpt4 book ai didi

powershell - 在 PowerShell 中连接到 CRM 2016 IFD

转载 作者:行者123 更新时间:2023-12-03 12:54:07 27 4
gpt4 key购买 nike

我想使用 PowerShell cmdlet 连接到 CRM 2016 服务器 Get-CrmConnection包含在 SDK 中。

我无法找到正确的连接字符串。

连接到本地网络中的服务器工作正常:

Get-CrmConnection -ConnectionString "Url=http://<server>/OrganizationName;"

但是连接到为 IFD 配置的服务器失败:
Get-CrmConnection -ConnectionString "Url=https://crm.ourdomain.com/"

Get-CrmConnection : Organization cannot be null or empty.
Parameter name: Organization Name
At line:1 char:1
+ Get-CrmConnection -ConnectionString "Url=https://crm.ourdomain.com/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SyntaxError: (:) [Get-CrmConnection], ArgumentNullException
+ FullyQualifiedErrorId : -9,Microsoft.Xrm.Tooling.CrmConnector.Powershell.Commands.GetCrmConnectionCommand

我尝试在连接字符串中添加 AuthType 参数,提供组织名称,但没有成功。重要的是我可以使用交互模式连接:
Get-CrmConnection -InteractiveMode

Interactive mode window

这将返回以下连接:
IsReady                        : True
IsBatchOperationsAvailable : True
Authority :
OAuthUserId :
ActiveAuthenticationType : AD
OrganizationServiceProxy : Microsoft.Xrm.Tooling.Connector.CrmWebSvc+ManagedTokenOrganizationServiceProxy
OrganizationWebProxyClient :
LastCrmError : OrganizationWebProxyClient is null
LastCrmException :
CrmConnectOrgUriActual : https://crm.ourdomain.com/XRMServices/2011/Organization.svc
ConnectedOrgFriendlyName : OrganizationName
ConnectedOrgUniqueName : OrganizationName
ConnectedOrgPublishedEndpoints : {[WebApplication, https://crm.ourdomain.com/], [OrganizationService,
https://crm.ourdomain.com/XRMServices/2011/Organization.svc],
[OrganizationDataService,
https://crm.ourdomain.com/XRMServices/2011/OrganizationData.svc]}
ConnectionLockObject : System.Object
ConnectedOrgVersion : 8.0.1.79

最佳答案

microsoft.xrm.tooling.connector 有一些大问题CrmConnection这可能会让你用头撞墙。

引自 http://crmtipoftheday.com/2016/01/14/rumors-about-microsoft-xrm-client-death-are-exaggerated/

Note the following:

  • Url must be in the form of https://orgname.contoso.com/orgname. For on-premises and IFD deployments the connector expects orgname to be
    at the end and looks like it does not make any attempt to deduce
    orgname from the server url.
  • Domain name must be specified but it’s not passed via claims, so it can be anything. Really any non-empty string o__O
  • Username must be UPN. If it’s not, then, since domain name is not passed it, ADFS 3.0 throws a fit (ADFS 2.0 assumes the domain)


以下对我有用
get-crmconnection -ConnectionString "Server=https://{orgname}.{domain}.com/{orgname}; Domain=this_isnt_used_but_must_be_provided; UserName={domain}\{user}; Password={password}"

稍加修改的用户名 UPN 也是如此
get-crmconnection -ConnectionString "Server=https://{orgname}.{domain}.com/{orgname}; Domain=this_isnt_used_but_must_be_provided; UserName={user}@{domain}; Password={password}"

关于powershell - 在 PowerShell 中连接到 CRM 2016 IFD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38441610/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com