microsoftgraph / microsoftgraph/microsoft-graph-comms-samples
[Policy Recording Bot] How can i run locally?
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 253
- Forks
- 275
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 1
Description
Hi Team.
I am going to run Policy Recording Bot locally. But I can't run this sample locally. I always get a exception.
How can i run locally? am I correct in steps below?
the steps I have done.
1, Got AppService Domain. (mydomain.com of course it's not real name)
2, Got Bot Registration and configured Teams Channel for calling like below.

3, Generated wild card certificate for mydomain.com with Let's Encrypt using Posh-ACME Powershell Module and Imported in my local machine certificate store.

4, Ran Ngrok.exe

5, Created CNAME Record in my azure dns zone for pointing to ngrok.

6, Ran the configure_cloud.ps1 script with these parameters.
.\configure_cloud.ps1 -p .\V1.0Samples\LocalMediaSamples\PolicyRecordingBot
-dns botsample.mydomain.com
-cn botsample.mydomain.com
-thumb {thumbprint from certificate I generated in step3}
-bid {my bot registration displayname}
-aid {my bot registration application Id}
-as {my bot registration application secret. this is not guid i set actual value.}
7, Ran my Visual Studio 2019 as adminstrator.
8, Right click Policy Recording Bot Service in solution explorer and click Debug.
after above, I recieved an exception below.
Microsoft.Graph.Communications.Core.Exceptions.ServiceException
HResult=0x80131500
Message=Code: mediaInitializationFailure
Message: Media platform failed to initialize
Source=Microsoft.Graph.Communications.Calls.Media
Stack Trace:
at Microsoft.Graph.Communications.Calls.Media.MediaCommunicationsClientBuilderExtensions.SetMediaPlatformSettings(ICommunicationsClientBuilder statefulClientBuilder, MediaPlatformSettings mediaSettings)
at Sample.PolicyRecordingBot.FrontEnd.Bot.Bot.Initialize(Service service, IGraphLogger logger) in C:\Work\Source\microsoft-graph-comms-samples-master\Samples\V1.0Samples\LocalMediaSamples\PolicyRecordingBot\FrontEnd\Bot\Bot.cs:line 94
at Sample.PolicyRecordingBot.FrontEnd.Service.Start() in C:\Work\Source\microsoft-graph-comms-samples-master\Samples\V1.0Samples\LocalMediaSamples\PolicyRecordingBot\FrontEnd\Service.cs:line 80
at Sample.PolicyRecordingBot.WorkerRole.WorkerRole.OnStart() in C:\Work\Source\microsoft-graph-comms-samples-master\Samples\V1.0Samples\LocalMediaSamples\PolicyRecordingBot\WorkerRole\WorkerRole.cs:line 92
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.b__0()
innerException 1:
InvalidOperationException: Cannot access the certificate's private key. Make sure that the process has enough permissions to access the private key. Only CSP-stored certificates are supported by the media platform, CNG/KSP certificates are not supported.
the message seems my certificate is not CSP-stored certificate. but I don't think so. did someone get same problem? Is there someone who solved this problem? Please help!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at FrontEnd/Bot/Bot.cs line 94 and FrontEnd/Service.cs line 80, then review configure_cloud.ps1 and the reported mediaInitializationFailure stack trace. Verify whether the certificate private key is accessible to the process and whether the certificate storage type meets the media platform requirement; done means the Policy Recording Bot starts locally without the initialization exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, powershell
- Domain
- backend, cloud, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100