|
| 1 | +--- |
| 2 | +title: How to enable CORS - Azure Data Manager for Energy Preview #Required; page title is displayed in search results. Include the brand. |
| 3 | +description: Guide on CORS in Azure data manager for Energy and how to set up CORS #Required; article description that is displayed in search results. |
| 4 | +author: NandiniMurali #Required; your GitHub user alias, with correct capitalization. |
| 5 | +ms.author: Nandinim #Required; microsoft alias of author; optional team alias. |
| 6 | +ms.service: energy-data-services #Required; service per approved list. slug assigned by ACOM. |
| 7 | +ms.topic: how-to #Required; leave this attribute/value as-is. |
| 8 | +ms.date: 02/28/2023 #Required; mm/dd/yyyy format. |
| 9 | +ms.custom: template-how-to-pattern #Required; leave this attribute/value as-is. |
| 10 | +--- |
| 11 | +# Use CORS for resource sharing in Azure Data Manager for Energy Preview |
| 12 | +This document is to help you as user of Azure Data Manager for Energy preview to set up CORS policies. |
| 13 | + |
| 14 | +## What is CORS? |
| 15 | + |
| 16 | +CORS (Cross Origin Resource Sharing) is an HTTP feature that enables a web application running under one domain to access resources in another domain. In order to reduce the possibility of cross-site scripting attacks, all modern web browsers implement a security restriction known as same-origin policy, which prevents a web page from calling APIs in a different domain. CORS provides a secure way to allow one origin (the origin domain) to call APIs in another origin. |
| 17 | +You can set CORS rules for each Azure Data Manager for Energy Preview instance. When you set CORS rules for the instance it gets applied automatically across all the services and storage accounts linked with Azure Data Manager for Energy Preview services. Once you set the CORS rules, then a properly authorized request made against the service evaluates from a different domain to determine whether it's allowed according to the rules you've specified. |
| 18 | + |
| 19 | + |
| 20 | +## Enabling CORS on Azure Data Manager for Energy instance Preview |
| 21 | + |
| 22 | +1. Create an **Azure Data Manager for Energy Preview** instance. |
| 23 | +2. Select the **Resource Sharing(CORS)** tab. |
| 24 | + [](media/how-to-enable-cors/enable-cors-1.png#lightbox) |
| 25 | + |
| 26 | +3. In the Resource Sharing(CORS) tab, select **Allowed Origins**. |
| 27 | +4. There can be upto 5 **Allowed Origins** added for a given instance. |
| 28 | + [](media/how-to-enable-cors/enable-cors-2.png#lightbox) |
| 29 | +5. If you explicitly want to have ***(Wildcard)**, then in the allowed origin * can be added. |
| 30 | +6. If no setting is enabled on CORS page it's defaulted to Wildcard*, allow all. |
| 31 | +7. The other values of CORS policy like **Allowed Methods**, **Allowed Headers**, **Exposed Headers**, **Max age in seconds** are set with default values displayed on the screen. |
| 32 | +7. Next, select “**Review+Create**” after completing other tabs. |
| 33 | +8. Select the "**Create**" button. |
| 34 | +9. An **Azure Data Manager for Energy Preview** instance is created with CORS policy. |
| 35 | +10. Next, once the instance is created the CORS policy set can be viewed in instance **overview** page. |
| 36 | +11. You can navigate to **Resource Sharing(CORS)** and see that CORS is enabled with required **Allowed Origins**. |
| 37 | + [](media/how-to-enable-cors/enable-cors-3.png#lightbox) |
| 38 | + |
| 39 | +## How are CORS rules evaluated? |
| 40 | +CORS rules are evaluated as follows: |
| 41 | +1. First, the origin domain of the request is checked against the domains listed for the AllowedOrigins element. |
| 42 | +2. If the origin domain is included in the list, or all domains are allowed with the wildcard character '*', then rules evaluation proceeds. If the origin domain isn't included, then the request fails. |
| 43 | + |
| 44 | +## Limitations on CORS policy |
| 45 | +The following limitations apply to CORS rules: |
| 46 | +- You can specify up to five CORS rules per instance. |
| 47 | +- The maximum size of all CORS rules settings on the request, excluding XML tags, shouldn't exceed 2 KiB. |
| 48 | +- The length of allowed origin shouldn't exceed 256 characters. |
| 49 | + |
| 50 | + |
| 51 | +## Next steps |
| 52 | +- CORS policy once set up during provisioning can be modified only through a Support request |
| 53 | + > [!div class="nextstepaction"] |
| 54 | + > [Create an Azure support request](../azure-portal/supportability/how-to-create-azure-support-request.md) |
| 55 | +- To learn more about CORS |
| 56 | + > [!div class="nextstepaction"] |
| 57 | + > [CORS overview](/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services) |
0 commit comments