WaelHamze / xrm-ci-framework

xRM CI Framework provides you with the tools automate the build and deployment of your CRM Solution. Using the framework to implement a fully automated DevOps pipeline will allow you to deploy more frequently with added consistency and quality.
MIT License
186 stars 117 forks source link

webhook Service Endpoint registration with querystring param #275

Open vcb-xrmvision opened 4 years ago

vcb-xrmvision commented 4 years ago

Did you know how to add the query string parameters to a webhook registration?

I presume it's the parameter "AuthValue" but I'm unable to specify to correct format or find documentation. I tried standard query string format or json key value array without success.

I'm trying to update a web hook registration pointing to a Azure Function using function key . Format : [appservicename].azurewebsites.net/api/[functionnname]?code=[functionKey that varies on each envir]

WaelHamze commented 4 years ago

@vcb-xrmvision are you trying to do this with Powershell or the tasks?

vcb-xrmvision commented 4 years ago

The end goal is with tasks but I tried both with the same result.

WaelHamze commented 4 years ago

@vcb-xrmvision have you tried the Service Endpoint Registration task with a json of this format? https://github.com/WaelHamze/dyn365-ce-devops-sample/blob/master/Sample/Xrm.CI.Framework.Sample/Xrm.CI.Framework.Sample.Plugins/ServiceEndpoints.json

https://github.com/WaelHamze/dyn365-ce-devops-sample/blob/master/Sample/Xrm.CI.Framework.Sample/Xrm.CI.Framework.Sample.Plugins/GetServiceEndpoints.ps1

You can generate the file using this script from your source environment and then replace any env specific values at runtime in the pipeline before the task.

vcb-xrmvision commented 4 years ago

@WaelHamze thanks so much for your time yes I tried and it is working like a charm for service bus connection. The issue is for webhook service where I need to provide query string parameter or header

ex. https://myappservice.azurewebsites.net/api/myfunction?code=xxx

the portion "?code=xxx" can't be provided in the URL and I'm not able to find any documentation on the format to use for "AuthValue"

I saw in the sample your provided ... "AuthValue": "EchoCode",
... I simply need to understand the format of the value EchoCode

Thanks again

WaelHamze commented 4 years ago

@vcb-xrmvision I think if you are using WebhookKey as auth then the AuthValue would be the key.

If you are using querystring or header, it gets a little bit more complicated.

I did some network tracing the other day.

Can you try to populate the AuthValue with a string in the below format and let me know if it works for you?

<settings><setting name="key1" value="v1" /><setting name="key2" value="v2" /></settings>

WaelHamze commented 4 years ago

@vcb-xrmvision any luck with this?

schwoi commented 3 years ago

@WaelHamze I am a bit late to this but just to let you know this really helped us. The Auth Value set with the XML works a treat. Thank You.