STORAGES Dictionary Ignores OPTIONS for Azure Storage in NetBox 4.2.7 #11015

Closed
opened 2025-12-29 21:39:10 +01:00 by adam · 11 comments
Owner

Originally created by @dattebayo-ua on GitHub (Apr 11, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.2.7

Python Version

3.12

Steps to Reproduce

Summary

When attempting to configure Azure blob storage for NetBox 4.2.7 via the new STORAGES dictionary (Django 5.1.8), Server appears to override the custom “default” backend and remove the "OPTIONS" key. Consequently, an error is raised about a missing container name.

Environment Details
• NetBox Version: 4.2.7
• Django Version: 5.1.8
• Python Version: 3.12.3
• Plugins: None installed
• Azure-Related Packages:

  • django-cors-headers==4.7.0
  • django-debug-toolbar==5.0.1
  • django-filter==25.1
  • django-htmx==1.23.0
  • django-graphiql-debug-toolbar==0.2.0
  • django-mptt==0.17.0
  • django-pglocks==1.0.4
  • django-prometheus==2.3.1
  • django-redis==5.4.0
  • django-rich==1.14.0
  • django-rq==3.0
  • django-taggit==6.1.0
  • django-tables2==2.7.5
  • django-timezone-field==7.1
  • djangorestframework==3.16.0
  • drf-spectacular==0.28.0
  • drf-spectacular-sidecar==2025.4.1
  • feedparser==6.0.11
  • gunicorn==23.0.0
  • Jinja2==3.1.6
  • Markdown==3.7
  • mkdocs-material==9.6.11
  • mkdocstrings[python]==0.29.1
  • netaddr==1.3.0
  • nh3==0.2.21
  • Pillow==11.1.0
  • psycopg[c,pool]==3.2.6
  • PyYAML==6.0.2
  • requests==2.32.3
  • rq==2.1.0
  • social-auth-app-django==5.4.3
  • social-auth-core==4.5.6
  • strawberry-graphql==0.263.2
  • strawberry-graphql-django==0.52.0
  • svgwrite==1.4.3
  • tablib==3.8.0
  • tzdata==2025.2
  • django-storages[azure]
  • azure-identity
  • boto

Steps to Reproduce

  1. Edit configuration.py to define STORAGES:
from azure.identity import DefaultAzureCredential

managed_identity_client_id = "UUID"

STORAGES = {
    'default': {
        'BACKEND': 'storages.backends.azure_storage.AzureStorage',
        'OPTIONS': {
            'token_credential': DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id),
            'account_name': 'mystorageaccount',
            'azure_container': 'media',
        },
    },
}
  1. Restart NetBox:

sudo systemctl restart netbox netbox-rq

  1. Check Final Settings:
sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py diffsettings --all
  • Observed result:
STORAGES = {
  'default': { 'BACKEND': 'storages.backends.azure_storage.AzureStorage' },
  'staticfiles': { 'BACKEND': 'django.contrib.staticfiles.storage.StaticFilesStorage' }
}

The OPTIONS block is gone.

  1. Encounter Error when NetBox tries to store files or load static:
<class 'ValueError'>
Please specify a container name.

This implies the Azure backend never received 'azure_container': 'media'.

  1. Also if STORAGE_BACKEND is omitted, the default also reverts to 'django.contrib.staticfiles.storage.StaticFilesStorage'.

Additional Notes
• NetBox 4.2.x historically relies on STORAGE_BACKEND / STORAGE_CONFIG for remote storage.
• Using Django 4.2+ STORAGES dictionary may not be fully supported or is overridden by NetBox’s Django (?) internal logic.
• No plugins or environment variables appear to override these settings.
• The environment has django-storages[azure] and azure-identity installed

Clarification: Is NetBox 4.2.x expected to support the new STORAGES dict approach from Django ≥4.2?

Expected Behavior

NetBox should respect the user-supplied STORAGES dictionary, including "OPTIONS". If "azure_container" is provided in the config, it shouldn’t raise a ValueError about missing container name.

Observed Behavior

  • The custom STORAGES["default"]["OPTIONS"] is stripped or overwritten, losing the container name.
  • Static files default to django.contrib.staticfiles.storage.StaticFilesStorage unless STORAGE_BACKEND is set.
Originally created by @dattebayo-ua on GitHub (Apr 11, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.2.7 ### Python Version 3.12 ### Steps to Reproduce # Summary When attempting to configure Azure blob storage for NetBox 4.2.7 via the new STORAGES dictionary (Django 5.1.8), Server appears to override the custom “default” backend and remove the "OPTIONS" key. Consequently, an error is raised about a missing container name. Environment Details • NetBox Version: 4.2.7 • Django Version: 5.1.8 • Python Version: 3.12.3 • Plugins: None installed • Azure-Related Packages: - django-cors-headers==4.7.0 - django-debug-toolbar==5.0.1 - django-filter==25.1 - django-htmx==1.23.0 - django-graphiql-debug-toolbar==0.2.0 - django-mptt==0.17.0 - django-pglocks==1.0.4 - django-prometheus==2.3.1 - django-redis==5.4.0 - django-rich==1.14.0 - django-rq==3.0 - django-taggit==6.1.0 - django-tables2==2.7.5 - django-timezone-field==7.1 - djangorestframework==3.16.0 - drf-spectacular==0.28.0 - drf-spectacular-sidecar==2025.4.1 - feedparser==6.0.11 - gunicorn==23.0.0 - Jinja2==3.1.6 - Markdown==3.7 - mkdocs-material==9.6.11 - mkdocstrings[python]==0.29.1 - netaddr==1.3.0 - nh3==0.2.21 - Pillow==11.1.0 - psycopg[c,pool]==3.2.6 - PyYAML==6.0.2 - requests==2.32.3 - rq==2.1.0 - social-auth-app-django==5.4.3 - social-auth-core==4.5.6 - strawberry-graphql==0.263.2 - strawberry-graphql-django==0.52.0 - svgwrite==1.4.3 - tablib==3.8.0 - tzdata==2025.2 - django-storages[azure] - azure-identity - boto ## Steps to Reproduce 1. Edit configuration.py to define STORAGES: ```python from azure.identity import DefaultAzureCredential managed_identity_client_id = "UUID" STORAGES = { 'default': { 'BACKEND': 'storages.backends.azure_storage.AzureStorage', 'OPTIONS': { 'token_credential': DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id), 'account_name': 'mystorageaccount', 'azure_container': 'media', }, }, } ``` 2. Restart NetBox: ```sudo systemctl restart netbox netbox-rq``` 3. Check Final Settings: ```bash sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py diffsettings --all ``` - Observed result: ```python STORAGES = { 'default': { 'BACKEND': 'storages.backends.azure_storage.AzureStorage' }, 'staticfiles': { 'BACKEND': 'django.contrib.staticfiles.storage.StaticFilesStorage' } } ``` The OPTIONS block is gone. 4. Encounter Error when NetBox tries to store files or load static: ``` <class 'ValueError'> Please specify a container name. ``` This implies the Azure backend never received 'azure_container': 'media'. 5. Also if STORAGE_BACKEND is omitted, the default also reverts to 'django.contrib.staticfiles.storage.StaticFilesStorage'. Additional Notes • NetBox 4.2.x historically relies on STORAGE_BACKEND / STORAGE_CONFIG for remote storage. • Using Django 4.2+ STORAGES dictionary may not be fully supported or is overridden by NetBox’s Django (?) internal logic. • No plugins or environment variables appear to override these settings. • The environment has django-storages[azure] and azure-identity installed Clarification: Is NetBox 4.2.x expected to support the new STORAGES dict approach from Django ≥4.2? ### Expected Behavior NetBox should respect the user-supplied STORAGES dictionary, including "OPTIONS". If "azure_container" is provided in the config, it shouldn’t raise a ValueError about missing container name. ### Observed Behavior - The custom STORAGES["default"]["OPTIONS"] is stripped or overwritten, losing the container name. - Static files default to django.contrib.staticfiles.storage.StaticFilesStorage unless STORAGE_BACKEND is set.
adam added the type: bugseverity: low labels 2025-12-29 21:39:10 +01:00
adam closed this issue 2025-12-29 21:39:11 +01:00
Author
Owner

@bctiemann commented on GitHub (Apr 11, 2025):

Clarification: Is NetBox 4.2.x expected to support the new STORAGES dict approach from Django ≥4.2?

No; currently only NETBOX_BACKEND and NETBOX_CONFIG as documented is supported in NetBox 4.2.x. However, in NetBox 4.3 there will be support for overriding STORAGES directly in configuration.py, which will be merged into the default STORAGES in settings.py.

@bctiemann commented on GitHub (Apr 11, 2025): >Clarification: Is NetBox 4.2.x expected to support the new STORAGES dict approach from Django ≥4.2? No; currently only `NETBOX_BACKEND` and `NETBOX_CONFIG` as [documented](https://netboxlabs.com/docs/netbox/en/stable/configuration/system/#storage_backend) is supported in NetBox 4.2.x. However, in NetBox 4.3 there will be support for overriding `STORAGES` directly in `configuration.py`, which will be merged into the default `STORAGES` in `settings.py`.
Author
Owner

@dattebayo-ua commented on GitHub (Apr 11, 2025):

@bctiemann Thank you for your reply. Unfortunately, I've encountered issues when configuring STORAGE_BACKEND and STORAGE_CONFIG as well:

from azure.identity import DefaultAzureCredential

managed_identity_client_id = "UUID"

STORAGE_BACKEND = "storages.backends.azure_storage.AzureStorage"
STORAGE_CONFIG = {
    "token_credential": DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id),
    "account_name": "mystorageaccount",
    "azure_container": "media",
}

Here's the output when checking the configured settings:
sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py diffsettings --all | grep 'STORAGE'
Image

The same error persists:

Image

@dattebayo-ua commented on GitHub (Apr 11, 2025): @bctiemann Thank you for your reply. Unfortunately, I've encountered issues when configuring STORAGE_BACKEND and STORAGE_CONFIG as well: ```python from azure.identity import DefaultAzureCredential managed_identity_client_id = "UUID" STORAGE_BACKEND = "storages.backends.azure_storage.AzureStorage" STORAGE_CONFIG = { "token_credential": DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id), "account_name": "mystorageaccount", "azure_container": "media", } ``` Here's the output when checking the configured settings: ```sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py diffsettings --all | grep 'STORAGE'``` ![Image](https://github.com/user-attachments/assets/1d43ad01-946f-4641-945f-05820c084008) The same error persists: ![Image](https://github.com/user-attachments/assets/8e8a16c6-9774-47d5-9cba-fca722b1fa05)
Author
Owner

@bctiemann commented on GitHub (Apr 11, 2025):

Hi @dattebayo-ua -- could you check my linked PR? I'm proposing to populate STORAGE_CONFIG directly into OPTIONS for the default backend. I'm not sure if that will have any side effects with backends I don't have available but maybe you could verify whether that does the trick?

@bctiemann commented on GitHub (Apr 11, 2025): Hi @dattebayo-ua -- could you check my linked [PR](https://github.com/netbox-community/netbox/pull/19157)? I'm proposing to populate `STORAGE_CONFIG` directly into `OPTIONS` for the default backend. I'm not sure if that will have any side effects with backends I don't have available but maybe you could verify whether that does the trick?
Author
Owner

@dattebayo-ua commented on GitHub (Apr 11, 2025):

@bctiemann I updated the code locally in my development environment and I can confirm it resolves the issue — media files are now uploading to the storage account. However, it still requires configuring STORAGE_BACKEND and STORAGE_CONFIG. As a result, 'staticfiles' still lacks its own 'OPTIONS' object.

So working code it:

from azure.identity import DefaultAzureCredential

STORAGE_BACKEND = "storages.backends.azure_storage.AzureStorage"
STORAGE_CONFIG = {
    "token_credential": DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id),
    "account_name": "mystorage",
    "azure_container": "media",
}

STORAGES = {
    "default": {
        "BACKEND": "storages.backends.azure_storage.AzureStorage",
        "OPTIONS": {
            "token_credential": DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id),
            "account_name": "mystorage",
            "azure_container": "media",
        },
    },
    "staticfiles": {
        "BACKEND": "storages.backends.azure_storage.AzureStorage",
        "OPTIONS": {
            "token_credential": DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id),
            "account_name": "mystorage",
            "azure_container": "static",
        },
    },
}

sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input --clear -v 3

Image

static blob in SA:

Image

media blob:

Image

@dattebayo-ua commented on GitHub (Apr 11, 2025): @bctiemann I updated the code locally in my development environment and I can confirm it resolves the issue — media files are now uploading to the storage account. However, it still requires configuring STORAGE_BACKEND and STORAGE_CONFIG. As a result, 'staticfiles' still lacks its own 'OPTIONS' object. So working code it: ```python from azure.identity import DefaultAzureCredential STORAGE_BACKEND = "storages.backends.azure_storage.AzureStorage" STORAGE_CONFIG = { "token_credential": DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id), "account_name": "mystorage", "azure_container": "media", } STORAGES = { "default": { "BACKEND": "storages.backends.azure_storage.AzureStorage", "OPTIONS": { "token_credential": DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id), "account_name": "mystorage", "azure_container": "media", }, }, "staticfiles": { "BACKEND": "storages.backends.azure_storage.AzureStorage", "OPTIONS": { "token_credential": DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id), "account_name": "mystorage", "azure_container": "static", }, }, } ``` ```sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input --clear -v 3``` ![Image](https://github.com/user-attachments/assets/5259e78a-68dd-49b9-9693-fd06460a7df3) static blob in SA: ![Image](https://github.com/user-attachments/assets/043c10f5-919d-41b8-aab3-86f4301e05e9) media blob: ![Image](https://github.com/user-attachments/assets/a2d15336-8edc-4ad1-8f00-50d498c8eb2e)
Author
Owner

@bctiemann commented on GitHub (Apr 14, 2025):

@dattebayo-ua Good point -- I've updated my PR to be more comprehensive and merge the entirety of STORAGES from configuration.py rather than just focusing on STORAGE_CONFIG. Could you see if this works better?

@bctiemann commented on GitHub (Apr 14, 2025): @dattebayo-ua Good point -- I've updated my PR to be more comprehensive and merge the entirety of `STORAGES` from `configuration.py` rather than just focusing on `STORAGE_CONFIG`. Could you see if this works better?
Author
Owner

@dattebayo-ua commented on GitHub (Apr 14, 2025):

Hi @bctiemann ,

I have updates settings.py

where removed previous change and add only

# Default STORAGES for Django
STORAGES = {
    "default": {
        "BACKEND": "django.core.files.storage.FileSystemStorage",
    },
    "staticfiles": {
        "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
    },
}
STORAGES.update(getattr(configuration, 'STORAGES', {}))

...

But now after

sudo systemctl restart netbox netbox-rq
sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input --clear -v 3

'm getting the following error message:

Traceback (most recent call last):
  File "/opt/netbox/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
    collected = self.collect()
                ^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 117, in collect
    self.clear_dir("")
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 254, in clear_dir
    dirs, files = self.storage.listdir(path)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/storages/backends/azure_storage.py", line 394, in listdir
    return [], self.list_all(path)
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/storages/backends/azure_storage.py", line 382, in list_all
    for blob in self.client.list_blobs(
                ^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/storages/backends/azure_storage.py", line 198, in client
    self._client = self.service_client.get_container_client(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/azure/storage/blob/_blob_service_client.py", line 724, in get_container_client
    return ContainerClient(
           ^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/azure/storage/blob/_container_client.py", line 142, in __init__
    parsed_url, sas_token = _parse_url(account_url=account_url, container_name=container_name)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/azure/storage/blob/_container_client_helpers.py", line 32, in _parse_url
    raise ValueError("Please specify a container name.")
ValueError: Please specify a container name.

That's how netbox loads configurations:

 sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py diffsettings --all | grep 'STORAGE'

STORAGES = {
    'default': {
        'BACKEND': 'storages.backends.azure_storage.AzureStorage', 
        'OPTIONS': {
            'token_credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7280d36ad2b0>, 
            'account_name': 'mystorage', 
            'azure_container': 'media'
            }
        }, 
    'staticfiles': {
        'BACKEND': 'storages.backends.azure_storage.AzureStorage', 
        'OPTIONS': {
            'token_credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7280d26004d0>, 
            'account_name': 'mystorage', 
            'azure_container': 'static'
            }
        }
}
STORAGE_BACKEND = None  ###
STORAGE_CONFIG = {}  ###

PS I tried different approaches where I also configured STORAGE_BACKEND or STORAGE_CONFIG or both of them together with STORAGES and same issue
PSS
Also when statfiles is not configured in STORAGES then everything is working as expected and medias are saved to azure SA, but static files as expected are saved on local storage

@dattebayo-ua commented on GitHub (Apr 14, 2025): Hi @bctiemann , I have updates settings.py where removed previous change and add only ```python # Default STORAGES for Django STORAGES = { "default": { "BACKEND": "django.core.files.storage.FileSystemStorage", }, "staticfiles": { "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", }, } STORAGES.update(getattr(configuration, 'STORAGES', {})) ... ``` But now after ```bash sudo systemctl restart netbox netbox-rq sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input --clear -v 3 ``` 'm getting the following error message: ```python Traceback (most recent call last): File "/opt/netbox/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle collected = self.collect() ^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 117, in collect self.clear_dir("") File "/opt/netbox/venv/lib/python3.12/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 254, in clear_dir dirs, files = self.storage.listdir(path) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/storages/backends/azure_storage.py", line 394, in listdir return [], self.list_all(path) ^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/storages/backends/azure_storage.py", line 382, in list_all for blob in self.client.list_blobs( ^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/storages/backends/azure_storage.py", line 198, in client self._client = self.service_client.get_container_client( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/azure/storage/blob/_blob_service_client.py", line 724, in get_container_client return ContainerClient( ^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/azure/storage/blob/_container_client.py", line 142, in __init__ parsed_url, sas_token = _parse_url(account_url=account_url, container_name=container_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/azure/storage/blob/_container_client_helpers.py", line 32, in _parse_url raise ValueError("Please specify a container name.") ValueError: Please specify a container name. ``` That's how netbox loads configurations: ```bash sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py diffsettings --all | grep 'STORAGE' ``` ``` STORAGES = { 'default': { 'BACKEND': 'storages.backends.azure_storage.AzureStorage', 'OPTIONS': { 'token_credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7280d36ad2b0>, 'account_name': 'mystorage', 'azure_container': 'media' } }, 'staticfiles': { 'BACKEND': 'storages.backends.azure_storage.AzureStorage', 'OPTIONS': { 'token_credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7280d26004d0>, 'account_name': 'mystorage', 'azure_container': 'static' } } } STORAGE_BACKEND = None ### STORAGE_CONFIG = {} ### ``` PS I tried different approaches where I also configured STORAGE_BACKEND or STORAGE_CONFIG or both of them together with STORAGES and same issue PSS Also when statfiles is not configured in STORAGES then everything is working as expected and medias are saved to azure SA, but static files as expected are saved on local storage
Author
Owner

@bctiemann commented on GitHub (Apr 15, 2025):

Since I don't have access to Azure storage all I can do is verify that settings.STORAGES looks correct, i.e.:

{'default': {'BACKEND': 'storages.backends.azure_storage.AzureStorage',
  'OPTIONS': {'token_credential': 'foo',
   'account_name': 'mystorage',
   'azure_container': 'media'}},
 'staticfiles': {'BACKEND': 'storages.backends.azure_storage.AzureStorage',
  'OPTIONS': {'token_credential': 'foo',
   'account_name': 'mystorage',
   'azure_container': 'static'}}}

Out of curiosity, what happens if you comment out this block?

ba5769f256/netbox/netbox/settings.py (L257-L262)

It may be that the monkey-patch is no longer necessary if STORAGES is being set outright.

@bctiemann commented on GitHub (Apr 15, 2025): Since I don't have access to Azure storage all I can do is verify that `settings.STORAGES` looks correct, i.e.: ``` {'default': {'BACKEND': 'storages.backends.azure_storage.AzureStorage', 'OPTIONS': {'token_credential': 'foo', 'account_name': 'mystorage', 'azure_container': 'media'}}, 'staticfiles': {'BACKEND': 'storages.backends.azure_storage.AzureStorage', 'OPTIONS': {'token_credential': 'foo', 'account_name': 'mystorage', 'azure_container': 'static'}}} ``` Out of curiosity, what happens if you comment out this block? https://github.com/netbox-community/netbox/blob/ba5769f25684125cec81f65f4ef6613c776763bc/netbox/netbox/settings.py#L257-L262 It may be that the monkey-patch is no longer necessary if `STORAGES` is being set outright.
Author
Owner

@bctiemann commented on GitHub (Apr 15, 2025):

@dattebayo-ua Because the handling of STORAGES has been reworked in NetBox v4.3 and the 4.3 beta is out now, could you please check that version and see if this is still an issue there? If so please retarget this issue for 4.3. If not I'm inclined to close this and my PR as there are diminishing returns for trying to chase a behavior in code that has no further lifecycle path.

@bctiemann commented on GitHub (Apr 15, 2025): @dattebayo-ua Because the handling of `STORAGES` has been reworked in NetBox v4.3 and the 4.3 beta is out now, could you please check that version and see if this is still an issue there? If so please retarget this issue for 4.3. If not I'm inclined to close this and my PR as there are diminishing returns for trying to chase a behavior in code that has no further lifecycle path.
Author
Owner

@dattebayo-ua commented on GitHub (Apr 16, 2025):

Hi @bctiemann,
I'd be happy to test the beta release! I'll need to wait until I return from vacation though, as I will not have access to my company environment. I'll let you know my feedback once I'm back :)

@dattebayo-ua commented on GitHub (Apr 16, 2025): Hi @bctiemann, I'd be happy to test the beta release! I'll need to wait until I return from vacation though, as I will not have access to my company environment. I'll let you know my feedback once I'm back :)
Author
Owner

@dattebayo-ua commented on GitHub (Apr 16, 2025):

Nah, did not want to wait :D
I tested it together with saving scripts in remote storage. All three types(media,static and scripts) are stored in our storage account and it unblocks us of using dynamic Netbox env with container apps.

But I noticed that pages are not rendering properly( there are missed some contents like arrows near expanded options only squares)

Image

So I guess this issue could be close

@dattebayo-ua commented on GitHub (Apr 16, 2025): Nah, did not want to wait :D I tested it together with saving scripts in remote storage. All three types(media,static and scripts) are stored in our storage account and it unblocks us of using dynamic Netbox env with container apps. But I noticed that pages are not rendering properly( there are missed some contents like arrows near expanded options only squares) ![Image](https://github.com/user-attachments/assets/fbc8c087-195e-40b4-b384-776f22ded722) So I guess this issue could be close
Author
Owner

@dattebayo-ua commented on GitHub (May 5, 2025):

UPDATE: If you are facing same issue you would need to configure CORS for azure storage

@dattebayo-ua commented on GitHub (May 5, 2025): UPDATE: If you are facing same issue you would need to configure CORS for azure storage
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11015