title: Azure Vnet Peering across subscriptions using Terraform
body: <p>I was wondering if someone could help me with setting up Vnet Peerings across subscriptions in Azure using Terraform. Each subscription is within the same tenant, but they have different service principals. I keep getting errors suggesting that the service principal cannot see the resource group in the other subscription. This is despite giving that service principal contributor access to the other subscription. </p>
  
  <p>This is an example of the code I have: </p>
  
  <pre><code>resource "azurerm_virtual_network_peering" "dev-to-test" {
    name                      = "dev-to-test"
    resource_group_name       = "gl-dev-rg"
    virtual_network_name      = "gl-dev-vnet"
    remote_virtual_network_id = "/subscriptions/subscriptionid/resourceGroups/gl-test-rg/providers/Microsoft.Network/virtualNetworks/gl-test-vnet"
    allow_virtual_network_access = true
    allow_forwarded_traffic   = true
  }
  
  resource "azurerm_virtual_network_peering" "test-to-dev" {
    name                      = "test-to-dev"
    resource_group_name       = "gl-test-rg"
    virtual_network_name      = "gl-test-vnet"
    remote_virtual_network_id = "/subscriptions/subscriptionid/resourceGroups/gl-dev-rg/providers/Microsoft.Network/virtualNetworks/gl-dev-vnet"
    allow_virtual_network_access = true
    allow_forwarded_traffic   = true
  }
  </code></pre>
  
  <p>Any help would be really appreciated! </p>
  
  <p>Further information can be found here:
  <a href="https://github.com/terraform-providers/terraform-provider-azurerm/issues/1253" rel="nofollow noreferrer">https://github.com/terraform-providers/terraform-provider-azurerm/issues/1253</a></p>