As stated in the question, I would like to know how to check whether Microsoft.Storage service endpoint in a private subnet is necessary or currently being used.
We have some resources that were created a long time ago, and we don't understand why the prod environment has this setting enabled while the non-prod doesn't. Both subnets contain storage, key vaults, and so on. However, the non-production environment has an empty list for this setting, and still works perfectly fine.
In our Terraform configuration, the subnet resource is formulated as follows (just a snippet):
resource "azurerm_subnet" "snet" {
provider = xxx
resource_group_name = var.rg_name
name = format("snet-%s", var.env)
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = [xxx]
enforce_private_link_endpoint_network_policies = xxx
enforce_private_link_service_network_policies = xxx
service_endpoints = var.env == "prod" ? ["Microsoft.Storage"] : []
depends_on = [azurerm_virtual_network.vnet]
}
Can I resolve this question using the Azure Portal, Terraform, or Azure CLI? To view this property on the Azure Portal, I navigate through: virtual network -> subnets -> service endpoints. Then I get this window:
Side note: removing the property and waiting whether prod goes down or not is not an option

Production state:
My main.tf as follows
Here in the first instance, I tried to replicate the service end point under the production condition where we are able to provision the service end point in the succeed state.
The
var.env == "prod"condition checks if the value of the variablevar.envis equal to the string"prod".If the condition evaluates to
true, the value assigned toservice_endpointswill be["Microsoft.Storage"], which is an array with a single element,"Microsoft.Storage".If the condition evaluates to
false, the value assigned toservice_endpointswill be an empty array[].Here the variable passed was when the code runs in production environment it creates the service at
Microsoft.Storage. Which in general used to store"Microsoft.Storage"service endpoint is included in theservice_endpointsarray to grant access to the Azure Storage service. By including this service endpoint, the associated resources (such as storage accounts and containers) can be accessed and utilized within the defined environment (in this case, the "prod" environment). It enables the application or infrastructure to interact with and leverage the capabilities provided by Azure Storage for storing and managing data in the cloud.Non-Production State:
For the var input other than prod the terraform will not provision the service
"Microsoft.Storage"which in general will not access any of the data available.So as per the query asked when the code runs under production environment the storage data will be captured using the module mentioned. Other than production (non-production or any other environment/Blank) then data will not be captured.
Regarding the last query you asked its totally depends on your requirements for data backups. If you consider this backup helpful you can continue or else it's your choice.