How to connect a bot to Skype for business - powershell

I am currently working with the Microsoft Bot Framework and am trying to connect my bot to the new Skype for business channel.
I've followed the instructions:
Download and install the Skype for Business Online Connector module
Open Windows PowerShell as Administrator and run the following:
Import-PSSession (New-CsOnlineSession -Credential (Get-Credential))
Enter your Admin credentials
Run the following cmdlet:
New-CsOnlineApplicationEndpoint -ApplicationId botid -Name NameOfTheBot -Uri sip:username#yourdomain
I got our tenant admin to enter his credentials and also to create a domain account for the bot with an Office 365 licence. (I tried first to register bot without an Office 365 licence assigned).
When the bot account had an office 365 licence and tried to call the New-CsOnlineApplicationEndpoint I got the following error:
Cmdlet invocation error
+ CategoryInfo : NotSpecified: (:) [New-CsOnlineApplicationEndpoint], CmdletInvocationException
+ FullyQualifiedErrorId : Error processing cmdlet request,Microsoft.Rtc.Management.Hosted.PlatformService.NewPlatformServiceAppEndpointConfigCmdlet
+ PSComputerName : admin1e.online.lync.com
Could not find the application endpoint
+ CategoryInfo : InvalidOperation: (Microsoft.Rtc.M...cation endpoint:PlatformServiceCmdletException) [New-CsOnlineApplicationEndpoint], PlatformServiceException
+ FullyQualifiedErrorId : Could not get application endpoint or the Uri is already present as an User in BVD,Microsoft.Rtc.Management.Hosted.PlatformService.NewPlatformServiceAppEndpointConfigCmdlet
+ PSComputerName : admin1e.online.lync.com
Without the Office 365 licence I got the following error:
Cmdlet invocation error
+ CategoryInfo : NotSpecified: (:) [New-CsOnlineApplicationEndpoint], CmdletInvocationException
+ FullyQualifiedErrorId : Error processing cmdlet request,Microsoft.Rtc.Management.Hosted.PlatformService.NewPlatformServiceAppEndpointConfigCmdlet
+ PSComputerName : admin1e.online.lync.com
Exception of type 'Microsoft.Rtc.Management.Hosted.PlatformService.ProvisioningLibrary.ApplicationEndpointProvisioningException' was thrown.
+ CategoryInfo : InvalidOperation: (Microsoft.Rtc.M...on' was thrown.:PlatformServiceCmdletException) [New-CsOnlineApplicationEndpoint], ApplicationEndpointProvisioningException
+ FullyQualifiedErrorId : Exception of type 'Microsoft.Rtc.Management.Hosted.PlatformService.ProvisioningLibrary.ApplicationEndpointProvisioningException' was thrown.,Microsoft.Rtc.Management.Hosted.PlatformService.NewPlatformServiceAppEndpointConfigCmdlet
+ PSComputerName : admin1e.online.lync.com
I've also followed some of the more generic info around the Skype for Business connector as detailed here: https://msdn.microsoft.com/en-us/skype/trusted-application-api/docs/trustedapplicationendpoint
I've also tried to use a new account as mentioned in this issue but got the same error: Unable to connect bot to Skype For Business Online

You need to target the domain:
sip:botname#company.onmicrosoft.com
It appears it will not work if you target your custom domains.

Related

Grant-CsTeamsAppPermissionPolicy not working in microsoft teams powershell

I am trying to apply permission policy to a user via powershell but it is not working
PS C:\Users\PO30261> Grant-CsTeamsAppPermissionPolicy -PolicyName "HR App Policy" -Identity d72f6b50-ac75-470a-80b8-919ab8b3232e
Get-CsOnlineSession : Connecting to remote server api.interfaces.records.teams.microsoft.com failed with the following error message : The WinRM client cannot process the request. Basic
authentication is currently disabled in the client configuration. Change the client configuration and try the request again. For more information, see the about_Remote_Troubleshooting Help
topic.
At C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\net472\SfBORemotePowershellModule.psm1:63 char:22
$remoteSession = & (Get-CsOnlineSessionCommand)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [Get-CsOnlineSession], PSRemotingTransportException
FullyQualifiedErrorId : PSRemotingTransportException,Microsoft.Teams.ConfigApi.Cmdlets.GetCsOnlineSession
Invoke-Command : Cannot validate argument on parameter 'Session'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\net472\SfBORemotePowershellModule.psm1:19581 char:38
... -Session (Get-PSImplicitRemotingSession -CommandName 'Grant-CsTeam ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidData: (:) [Invoke-Command], ParentContainsErrorRecordException
FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand
Error shows that issue is not related to apply policy. Issue is with connecting to server "Basic authentication is currently disabled in the client configuration" so update module and try again. Update-Module MicrosoftTeams
Seems like a problem with powerShell version. Look at this discussion where community are following this issue, including me:
https://techcommunity.microsoft.com/t5/teams-developer/authenticating-with-an-access-token-connect-microsoftteams/m-p/2233794

Connecting Skype for Business with ChatBot

I am trying to deploy Bot on skype and facing this error,
Could anyone please suggest the solution for the same:
PS C:\WINDOWS\system32> $TenentAdminDomainId = Read-Host -Prompt 'Input your domain id in <user>#<domain>.com'
Input your domain id in <user>#<domain>.com: test2#botwork.onmicrosoft.com
PS C:\WINDOWS\system32> New-CsOnlineApplicationEndpoint -ApplicationId fc1d28c4-7ff2-41dd-9a1b-a5652949d051 -Name TestBotAP -Uri sip:$TenentAdminDomainId
Cmdlet invocation error
+ CategoryInfo : NotSpecified: (:) [New-CsOnlineApplicationEndpoint], CmdletInvocationException
+ FullyQualifiedErrorId : Error processing cmdlet request,Microsoft.Rtc.Management.Hosted.PlatformService.NewPlatformServiceAppEndpointConfigCmdlet
+ PSComputerName : adminin1.online.lync.com
Could not find the application endpoint
+ CategoryInfo : InvalidOperation: (Microsoft.Rtc.M...cation endpoint:PlatformServiceCmdletException) [New-CsOnlineApplicationEndpoint], PlatformServiceException
+ FullyQualifiedErrorId : Could not get application endpoint or the Uri is already present as an User in BVD,Microsoft.Rtc.Management.Hosted.PlatformService.NewPlatformServiceAppEndpointConfigCmdlet
+ PSComputerName : adminin1.online.lync.com
From https://learn.microsoft.com/en-us/skype-sdk/skype-for-business-bot-framework/docs/bot-common-errors
FullyQualifiedErrorId : Could not get application endpoint or the Uri
is already present as a User in BVD
Delete the existing user account with the same sipuri in tenant, or
run the cmdlet using a sipuri that does not already exist in the
tenant.

AzureRM Add-AzureRmADGroupMember failing

I am trying to add a service principal from a Web App (Managed Service Identity) in to an Azure AD group and can't figure out why I am getting an error. I am using AzureRM 6.0.1. Any idea where I may be going wrong?
PowerShell Command:
Add-AzureRmADGroupMember -MemberObjectId 3cc2d09c-4fd4-4251-aa42-9ad6a0440606 -TargetGroupObjectId 2ca727c0-e2ec-46d4-9202-2144d83eb6b5 -PassThru
Error:
Add-AzureRmADGroupMember : The URI
'https://graph.windows.net//Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureTenant/directoryObj
ects/3cc2d09c-4fd4-4251-aa42-9ad6a0440606' is not valid since it is
not based on
'https://graph.windows.net/fdfed904-9e03-4e17-89c4-61053e0777be/'. At
line:2 char:2
+ Add-AzureRmADGroupMember -MemberObjectId 3cc9d09c-4fd4-4251-aa42-9ad ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Add-AzureRmADGroupMember], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ActiveDirectory.AddAzureADGroupMemberCommand

Enable Skype for business channel for a chatbot

I am using one Azure account where I have the AD app linked with Skype for business subscription, and another Azure account where I have hosted the chatbot.
I am running the following powershell commands:
Import-PSSession (New-CsOnlineSession -Credential (Get-Credential))
and:
New-CsOnlineApplicationEndpoint -ApplicationId 561bae84-ea1c-4f75-a512-b84566779c2w -Name NameOfTheBot -Uri sip:username#yourdomain.com
With, of course, giving name and sip id.
I am getting following error in powershell:
Cmdlet invocation error
+ CategoryInfo : NotSpecified: (:) [New-CsOnlineApplicationEndpoint], CmdletInvocationException
+ FullyQualifiedErrorId : Error processing cmdlet request,Microsoft.Rtc.Management.Hosted.PlatformService.NewPlatf
ormServiceAppEndpointConfigCmdlet
+ PSComputerName : adminin1.online.lync.com
Could not find the application endpoint
+ CategoryInfo : InvalidOperation: (Microsoft.Rtc.M...cation endpoint:PlatformServiceCmdletException) [Ne
w-CsOnlineApplicationEndpoint], PlatformServiceException
+ FullyQualifiedErrorId : Could not get application endpoint or the Uri is already present as an User in BVD,Micro
soft.Rtc.Management.Hosted.PlatformService.NewPlatformServiceAppEndpointConfigCmdlet
+ PSComputerName : adminin1.online.lync.com
Should Skype for business and chatbot be linked with the same account?

Error when executing Get-AzureStorageAccount in azure powershell

Here is the error
PS C:\Windows\system32> Get-AzureStorageAccount
Get-AzureStorageAccount : Value cannot be null.
Parameter name: resource
At line:1 char:1
+ Get-AzureStorageAccount
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureStorageAccount], AadAuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication.AadAuthenticationFailedException,Microsoft.WindowsAzure.Commands.ServiceManagement.StorageServices.GetAzureStorageAccountCommand
I am getting the same error on
Get-AzureLocation,
Get-AzureWebsite
I have imported my settings file and Get-AzureSubscription works just fine and provides me all the correct information.
This solved my issue, got this from Microsoft support forum.
As far as my research goes on this, the issue can be related to cache of some account. If just adding does not work, I suggest that you remove and add the subscription again:
This article will give you information on this:
http://msdn.microsoft.com/en-us/library/dn495268.aspx