network api NetworkSecurityGroup#name is nil
Hi, I'm obtaining instance security group. #name is always nil.
nic_ref = instance.network_profile.network_interfaces.find { |nic|
nic.primary
}
m = nic_ref.id.match(%r{/resourceGroups/([^/]+)/.*/([^/]+)$})
nic = net_client.network_interfaces.get(m[1], m[2])
security_group = nic.network_security_group
return security_group&.name
The result is always nil whether or not security_group exists or not.
Same with Subnet:
# expand option might help: https://stackoverflow.com/questions/52121456
subnet_id = nic.ip_configurations.find {|ipc| ipc.primary}.subnet.id
m = subnet_id.match(%r{/resourceGroups/([^/]+)/.*/virtualNetworks/([^/]+)/subnets/([^/]+)$})
subnet = net_client.subnets.get(m[1], m[2], m[3])
security_group = subnet.network_security_group
return security_group&.name
I need to parse out the name from the #id string.
This is a service related issue. The service returns nil value. I have notified the service team and the Network label has been added. I will follow up with them and update this issue soon.
Thank you for your interest in Azure SDKs. As detailed in this retirement announcement, this repo is no longer supported as of December 31st 2021. Please find the up-to-date list of languages and services supported with Azure SDKs here: https://aka.ms/azsdk