-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_public_ip.iql
More file actions
39 lines (36 loc) · 1.24 KB
/
example_public_ip.iql
File metadata and controls
39 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*+ createorupdate */
INSERT INTO azure.network.public_ip_addresses(
publicIpAddressName,
resourceGroupName,
subscriptionId,
data__location,
data__sku,
data__properties,
data__tags
)
SELECT
'{{ public_ip_name }}',
'{{ resource_group_name }}',
'{{ subscription_id }}',
'{{ location }}',
'{"name":"Standard","tier":"Regional"}',
'{"publicIPAllocationMethod":"Static"}',
'{{ global_tags }}'
/*+ statecheck, retries=5, retry_delay=5 */
SELECT COUNT(*) as count FROM azure.network.public_ip_addresses
WHERE subscriptionId = '{{ subscription_id }}'
AND resourceGroupName = '{{ resource_group_name }}'
AND publicIpAddressName = '{{ public_ip_name }}'
/*+ exports */
SELECT '{{ public_ip_name }}' as public_ip_name,
JSON_EXTRACT(properties, '$.ipAddress') as public_ip_address,
id as public_ip_id
FROM azure.network.public_ip_addresses
WHERE subscriptionId = '{{ subscription_id }}'
AND resourceGroupName = '{{ resource_group_name }}'
AND publicIpAddressName = '{{ public_ip_name }}'
/*+ delete */
DELETE FROM azure.network.public_ip_addresses
WHERE subscriptionId = '{{ subscription_id }}'
AND resourceGroupName = '{{ resource_group_name }}'
AND publicIpAddressName = '{{ public_ip_name }}'