> For the complete documentation index, see [llms.txt](https://user.netmera.com/netmera-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://user.netmera.com/netmera-developer-guide/integrations/content-storage-network/azure-storage.md).

# Azure Storage

The Azure Storage connector integrates Netmera with Microsoft Azure's Blob Storage service. It is categorized as a Cloud Storage Service, providing highly scalable and reliable storage for media and file assets, primarily serving as a high-priority **fallback option** to Amazon S3.&#x20;

### Overview

<table><thead><tr><th width="254.20001220703125">Attribute</th><th>Details</th></tr></thead><tbody><tr><td><strong>Connector Name</strong></td><td>Azure Storage</td></tr><tr><td><strong>Category</strong></td><td>Cloud Storage Network (CDN) / Depolama Connector'ları</td></tr><tr><td><strong>Provider</strong></td><td>Microsoft Azure</td></tr><tr><td><strong>Primary Function</strong></td><td>File storage and retrieval (media, attachments, widgets).</td></tr><tr><td><strong>Netmera Component</strong></td><td><code>CloudStorageAzure.java</code> class</td></tr><tr><td><strong>Data Flow</strong></td><td><strong>Outbound</strong> (Netmera > Azure Blob Storage)</td></tr><tr><td><strong>Precedence</strong></td><td><strong>Secondary Storage</strong> (Used only if Amazon S3 is not configured).</td></tr></tbody></table>

&#x20;The `CloudStorageServiceImpl` manages file routing, giving explicit priority to Amazon S3. Azure Storage is integrated as a necessary alternative to ensure cloud storage capabilities are maintained if the primary AWS solution is unavailable.

### Use Cases and Benefits

Azure Storage fulfills the same core functions as the Amazon S3 connector, ensuring system capability regardless of the primary cloud vendor choice.

1. **Messaging Assets and Thumbnails:** Stores images and generated thumbnail versions uploaded for Push Notifications, Email, and SMS messages, **provided Amazon S3 is not active**.
2. **Widget Media:** Saves images utilized in Netmera’s "Widgets" and handles the automatic conversion of embedded Base64 images in HTML widgets into publicly accessible Azure Blob URLs (if S3 is inactive).
3. **Email Attachments:** Supports the storage of file attachments included in outbound email messages (e.g., invoices, reports), allowing email providers like Amazon SES to reference these files during delivery.
4. **CDN Functionality:** Files uploaded to Azure Storage are served via CDN URLs generated by Netmera's CdnService.getCdnUrl() method, ensuring optimized global distribution of media assets.
5. **Fallback Reliability:** Its primary benefit is providing **failover storage**; if the Amazon Storage connector is deactivated or unconfigured, Azure Storage ensures that content creation processes relying on cloud file hosting can continue without interruption.

### Data Flow

The data flow is **Outbound** for file uploads and **Bidirectional** regarding public media consumption (devices retrieving content from the CDN URL).

1. **Upload Trigger:** A media upload request is initiated by an admin user (e.g., uploading a message image).
2. **Priority Check:** The `CloudStorageServiceImpl` checks for an active Amazon S3 configuration.
3. **Routing:** If the Amazon S3 configuration is absent or inactive, the service routes the file payload to the CloudStorageAzure class.
4. **API Submission:** Netmera authenticates using the configured accountName and accountKey and uploads the file content to the specified containerName.
5. **URL Generation:** Netmera creates the public CDN URL pointing to the newly uploaded blob within Azure Storage, and this URL is embedded in the message or widget content.

### Configuration Reference

The Azure Storage connector requires specific account and container details from the Microsoft Azure portal.

| Parameter                    | Type   | Description                                                                                     | Azure Context                                     |
| ---------------------------- | ------ | ----------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| **accountName**              | String | The name of your Azure storage account.                                                         | Identifies the storage resource.                  |
| **accountKey**               | String | The primary or secondary access key for your Azure storage account.                             | Used for API authentication and write access.     |
| **defaultEndpointsProtocol** | String | The endpoint protocol (e.g., "https" or "http").                                                | HTTPS is recommended for security.                |
| **endpointSuffix**           | String | The DNS suffix for the storage endpoint (e.g., "[core.windows.net](http://core.windows.net/)"). | Defines the Azure cloud environment.              |
| **containerName**            | String | The name of the Blob container where files will be stored.                                      | The specific location within the storage account. |

### Setup Instructions

Setting up Azure Storage requires provisioning resources in the Azure Portal and configuring Netmera accordingly.

1. **Prerequisites (Azure Portal):** Create an Azure account and then provision a **Storage Account** and a **Blob container** within the Azure Portal.
2. **Obtain Credentials:** Retrieve the **Storage Account Name** and one of the **Access Keys** (Key1 or Key2) from the "Access keys" section of your storage account settings. Note the desired **Container Name**.
3. **Configure in Netmera:** Access the Netmera Control Panel's **Connectors** section and select **Azure Storage**.
4. **Input Data:** Input the obtained accountName, accountKey, containerName, and specify the defaultEndpointsProtocol (preferably "https") and the endpointSuffix (usually "[core.windows.net](http://core.windows.net/)").
5. **Save:** Click the **Save Configuration** button to activate the connector.

### Usage Notes & Considerations

1. **Secondary Priority:** The most critical limitation is its **secondary role**. Azure Storage is only invoked if the Amazon Storage connector is **not configured**. If both are configured, Amazon Storage (S3) takes precedence.
   * *Reference:* The CloudStorageServiceImpl explicitly routes file uploads to Amazon S3 first.
2. **File Management Exclusion:** Like Amazon S3, the Azure Storage connector **DOES NOT** handle file uploads initiated via the **File Management** section of the Control Panel (e.g., large CSV/Excel files for bulk user uploads, blacklist/whitelist files). These specific file types are handled by separate systems, typically utilizing **FTP or MinIO** storage solutions.
3. **Credential Management:** The functionality hinges entirely on the validity of the accountKey. If the key is regenerated or revoked in the Azure Portal, file uploads will immediately fail until the corresponding configuration in Netmera is updated.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://user.netmera.com/netmera-developer-guide/integrations/content-storage-network/azure-storage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
