Skip to content

Unable to create SQL VirtualNetworkRule due to virtual_network_subnet_id validation #15221

@rickporter-tuono

Description

@rickporter-tuono
  • Package Name: azure.mgmt.sql
  • Package Version: 0.23 and 0.24
  • Operating System: Mac/Linux
  • Python Version: 3.7/3.8

Describe the bug
The VirtualNetworkRule creation seems to consistently fail due to incorrect virtual_network_subnet_id validation.

Always fails with LinkedInvalidPropertyId when attempting to create a VirtualNetworkRule on an Sql server. I tried several permutations of the virtual_network_subnet_id (e.g. /subscription/..., /providers/...) with and without trailing '/' on the subnet id.

The error appears to come from azure/mgmt/sql/operations/_virtual_network_rules_operations.py:206
E msrestazure.azure_exceptions.CloudError: Azure Error: LinkedInvalidPropertyId
E Message: Property id '{'virtual_network_subnet_id': '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'}' at path 'properties.virtualNetworkSubnetId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.

To Reproduce
Steps to reproduce the behavior:

  1. Create resource group
  2. Create virtual network with a subnet (with or without a Microsoft.Sql ServiceEndpoint)
  3. Create an Sql server
  4. Attempt to add a VirtualNetworkRule to the server using the SDK

Expected behavior
I was expecting that I would be able to create a VirtualNetworkRule on the server, similar to the way that I can do it from the GUI.

Screenshots
NA

Additional context
A couple things I noticed:

  1. API version seems old
  2. GUI seems to show a subnet address range when creating a VirtualNetworkRule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MgmtThis issue is related to a management-plane library.SQLService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-author-feedbackWorkflow: More information is needed from author to address the issue.no-recent-activityThere has been no recent activity on this issue.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions