Access JS file in SPFx web part from secured Azure CDN
Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.
Category
- [x] Question
- [ ] Typo
- [ ] Bug
- [ ] Additional article idea
- [ ] Example checked item (delete this line)
#AzureCDN
Question: I have to access file from azure cdn in spfx app. Azure cdn is secured. While accessing js file we need add qury string. Is there any way to add the query string parameters.
Example : https://azureurl/containername/filename.js?q1=1&q2=2&q3=3
Default path is https://azureurl/containername/filename.js
JS File Path generated using base azure cdn path in mentioned in spfx webpart write-manifests.json.
{ "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json", "cdnBasePath": "" }
In which file of SPfx web part project we need to change to add query string parameter while accessing JS file form Azure CDN.
Any help will be appreciated.
Thanks for your contribution! Sharing is caring.
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Not clear... what do you mean about a "secured Azure CDN"... the private Office 365 CDN?
No, it is Azure CDN only but while accessing file from Azure CDN we need to pass certain query string parameter as shown below
https://azureurl/containername/filename.js?q1=1&q2=2&q3=3
so how to configure CDN Base path URL with Query string parameter
The cdnBasePath used to specify the root path of your cdn, so it's not the case to add query string parameters.
If you view the package file, you could find it also.

And you cannot deploy SPFx solutions using private CDN at least currently
@HanumantPatil The CDN base path is used to retrieve the JS bundle & JSON manifest for your component stored in the Azure CDN. SPFx does this when loading the script. There is no capability to specify any query string parameters as SPFx's module loader is using that to load the files needed for the component when adding them to the page.
Closing issue as "answered". If you encounter similar issue(s), please open up a NEW issue. Thank you.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues