Azure 为PartnerCenter生成新的访问令牌

Azure 为PartnerCenter生成新的访问令牌,azure,powershell,Azure,Powershell,大约3个月前,我创建了一个用于登录Microsoft PartnerCenter的令牌,该令牌现在已过期,我需要创建一个新的令牌,但我丢失了我使用的代码,当按照文档中的说明操作时,该令牌不起作用 我试图遵循文档中的示例1: 但让我困惑的是我应该在凭证对象中放什么?是AppID和应用程序机密还是其他原因 $TenantID = "MyTenant" # Tenant $ApplicationID = "MyAppID" # Application in Tenant "Partner Cente

大约3个月前,我创建了一个用于登录Microsoft PartnerCenter的令牌,该令牌现在已过期,我需要创建一个新的令牌,但我丢失了我使用的代码,当按照文档中的说明操作时,该令牌不起作用

我试图遵循文档中的示例1:

但让我困惑的是我应该在凭证对象中放什么?是AppID和应用程序机密还是其他原因

$TenantID = "MyTenant" #  Tenant
$ApplicationID = "MyAppID" # Application in Tenant "Partner Center"
$ApplictionSecret = "MyAPPSecreat" 

$credential = New-Object PSCredential ($ApplicationID, (ConvertTo-SecureString $ApplictionSecret -AsPlainText -Force))
$token = New-PartnerAccessToken -ApplicationId $ApplicationID -Scopes 'https://api.partnercenter.microsoft.com/user_impersonation' -ServicePrincipal -Credential $credential -Tenant $TenantID -UseAuthorizationCode
当我运行此程序时,会发生什么情况?我的webbrowser将打开并要求我登录,而当我登录时,它只会创建一个新选项卡,在powershell窗口中,我会收到一条警告,每次我这样做时,端口号都会增加

WARNING: Port 8400 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8401 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8402 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8403 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Attempting to launch a browser for authorization code login.
WARNING: We have launched a browser for you to login. For the old experience with device code flow, please run 'New-PartnerAccessToken -UseDeviceAuthentication'.
WARNING: Port 8400 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8401 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8402 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8403 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8404 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Attempting to launch a browser for authorization code login.
WARNING: We have launched a browser for you to login. For the old experience with device code flow, please run 'New-PartnerAccessToken -UseDeviceAuthentication'.
WARNING: Port 8400 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8401 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8402 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Port 8403 is taken with exception 'Only one usage of each socket address (protocol/network address/port) is normally permitted'; trying to connect to the next port.
WARNING: Attempting to launch a browser for authorization code login.
WARNING: We have launched a browser for you to login. For the old experience with device code flow, please run 'New-PartnerAccessToken -UseDeviceAuthentication'.
不,在我运行命令之前,在该端口上没有任何阻塞/侦听。我尝试重新启动计算机,并使用netstat验证端口上没有侦听内容


还要注意的是,我使用的应用程序与3个月前我设法让它工作时使用的应用程序相同,因此我怀疑这是配置错误。可能是我在代码中出错了

所以这个问题的解决方法相当简单

我只需将默认浏览器更改为Internet Explorer(从Chrome浏览器)就可以了。好像是某种虫子