Search code examples
powershelllyncucmalync-2010

Understanding PowerShell cmdlet for adding a trusted UCMA 4.0 application and a trusted UCMA 4.0 application endpoint


I am trying to create a UCMA 4.0 application for Lync 2010. In the development phase the application will be hosted in my laptop and the lync server (on which I have no jurisdiction) will connect to my laptop and run the application. The OS in my laptop is Windows 7 SP 1 and the .Net framework is 4.5.

I am fairly new to UCMA coding and though I have studied about it, there are still some grey areas that needs to be addressed. Below are some of the questions that I have failed to get a clear answer of. Also, it is more important for me to understand the nitty gritties because the Lync server admin is a new person on the job who has, like me, never worked on UCMA applications.

  1. I need to create an application pool. For that, the PowerShell cmdlet to be used is

    New-CsTrustedApplicationPool -Identity foo.example.com -Registrar [Registrar Id] -Site [Site id] –ComputerFqdn foo.example.com
    

    I assume this cmdlet must be run on the lync server. Since my laptop will be the only computer in the application pool in the development phase so my -ComputerFQDN and -Identity of the application pool are the same. Is this correct? Also, where will I get the Registrar ID and the Site ID? What is the difference between a manually provisioned application and an auto provisioned application?

  2. To add a trusted application:

    New-CSTrustedApplication –ApplicationId $ApplicationId -TrustedApplicationPoolFqdn $ApplicationFqdn -Port $PortNo
    

    What exactly is application id. Is it my computer FQDN/application_name? I have assumed that the TrustedApplicationPoolFqdn is the same as my computer FQDN since there is only a single computer in the application pool. Also, will any available port no. do or should it be the one listening to my application? Since, I have not completed coding my application, getting the exact port no. is not possible. They want to setup the server before the coding is done. That is the challenge.

  3. To create the trusted application endpoint:

    New-CSTrustedApplicationEndpoint –ApplicationId $ApplicationId -TrustedApplicationPoolFqdn  $ApplicationFqdn -SipAddress $ApplicationSipAddress –DisplayName
    

    What is -SipAddress here? Where and how will I get the SIP address?

I know I have crammed a lot of questions here. But I am running low on knowledge and available resources and I am in a desperate need of some direction, given the time constraints that I am facing. Apart from the questions if anybody can help me with any heads up, you are more than welcome and appreciated to do so. All I need right now is some perspective from the stackoverflow community.


Solution

  • I assume this cmdlet must be run on the lync server. Since my laptop will be the only computer in the application pool in the development phase so my -ComputerFQDN and -Identity of the application pool are the same. Is this correct?

    No. It can be run from any computer that has the Lync / SfB powershell commands installed and you have enough "rights" to run the powershell commands. I run these sorts of commands from my dev machine all the time.

    I normally develop with UCMA v4 (not 5) and when you install ocscore.msi from the SDK/runtime install or copy it from the Lync 2013 install. You can get the SfB powershell to install but I've found it be more of a pain than the Lync 2013 version and mostly you don't need SfB version (i.e. the Lync 2013 powershell commands work fine on a SfB server install).

    Also, where will I get the Registrar ID and the Site ID?

    The Registrar ID is the front end pool (the sip proxy to register with). You can get it with the powershell command: Get-CsService -Registrar

    Look at the "Identity" field and should look like: Registrar:name.lyncdomain e.g. Registrar:myserver.company.com

    You can get the Site ID from the Get-CsSite command. It should look like: Site:ID e.g. Site:MY_SITE

    What is the difference between a manually provisioned application and an auto provisioned application?

    This is a very big difference.

    A manually provisioned application requires more code to setup and run your UCMA trusted application. You have to know all the settings and all the trusted application endpoints yourself.

    A auto provisioned application requires less code to setup and run. All you need is a id and with that id you can query the UCMA API to pull all that trusted application setup and all the trusted application endpoints. This sounds great but the downside of a auto provisioned application setup means that all the computers in the application pool has to be setup as a replication point for the Lync database. To setup the computer as a replication point is a BIG pain in the pass (it takes about 1/2 hour to setup if you know what you are doing).

    I suggest setting your application pool / application as a manually provisioned application as it's actually a lot simpler to setup in the long run unless you require the ability to automatically "know" what trusted application endpoints are setup to your application.

    What exactly is application id.

    Anything you like. It just needs to be unique (kind of) within the Lync environment. You can use Get-CsTrustedApplication command to see what other application id's are already in use. It basically is the unique ID for your application.

    Is it my computer FQDN/application_name?

    It is the FQDN (fully qualified domain name) of the application pool. If should match the application pool ComputerFqdn value. It's basically telling Lync what application pool that this trusted application runs on. Trusted applications can only run on a application pool computer only.

    is the same as my computer FQDN since there is only a single computer in the application pool.

    In a single computer application pool, yes. In a multi-computer application pool, no. It is the ComputerFqdn of the pool.

    Also, will any available port no. do or should it be the one listening to my application?

    The port number has to be a available port on the pool computer. It is used by the UCMA application to listen on and is used by the Lync server (FE) to connect to the UCMA application as per the SIP RFC.

    For auto provisioned application, the UCMA application will auto-load this value and use it. For manual provisioned application, you can either hard code it or load it from your own config setup (e.g. from registry?). I would recommend that you load from your own config somewhere like the registry.

    What is -SipAddress here? Where and how will I get the SIP address?

    It's whatever you want it to be. It needs to be a unique SIP address within the whole Lync setup. It should be in the format of sip:name@lyncdomain e.g. sip:[email protected] It will be the primary entry point for SIP messages into your application if your application even uses / wants a sip endpoint to: make audio calls, receive audio calls, provide presence, send/receive IM messages, etc.

    If you aren't going to use a trusted application endpoint (e.g. you only want to impersonate user endpoints) then you don't need any trusted application endpoints.