Skip to content

Commit 44f90b9

Browse files
authored
Add service endpoints
1 parent abe6861 commit 44f90b9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

healthcheck/healthcheck_webapps_refarch.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
4141
subnets_cidr,
4242
resource_name_vnet,
4343
vnet_cidr)
44+
network_client = NetworkManagementClient(credentials, subscription_id)
45+
# Add service endpoint to subnets
46+
for subnet_name in subnet_names:
47+
subnet = network_client.subnets.get(resource_name_vnet, vnet_name, subnet_name)
48+
if not subnet.service_endpoints:
49+
subnet.service_endpoints = []
50+
subnet.service_endpoints.append(
51+
ServiceEndpointPropertiesFormat(service='Microsoft.Storage')
52+
)
53+
updated_subnet = network_client.subnets.create_or_update(
54+
resource_name_vnet,
55+
vnet_name,
56+
subnet_name,
57+
subnet
58+
).result()
59+
print(f"Enabled Microsoft.Storage service endpoint for subnet: {subnet_name}")
4460
except Exception as e:
4561
raise(e)
4662
print(subnet_name[0])

0 commit comments

Comments
 (0)