Understanding New-AzSqlDatabaseImport and the client IP address RRS feed

  • Question

  • Hi,

    I am writing a script to import a bacpac file into my sql server and the only issue I have is that the New-AzSqlDatabaseImport cmdlet fails due to the firewall configuration, which is fine and I expected that.

    I then added a firewall rule to allow my client IP to have access, however when I run the cmdlet I still receive the same error but then I notice the IP address referenced in that message is not my outwardly facing IP or the Client IP shown within the Azure Portal, the message is: -

    0: There was an error that occurred during this operation : '<string xmlns="">Error encountered during the service operation. ; Exception Microsoft.SqlServer.Management.Dac.Services.ServiceException:Unable to authenticate request; Inner exception System.Data.SqlClient.SqlException:Cannot open server &amp;#39;lloyds&amp;#39; requested by the login. Client with IP address &amp;#39;;#39; is not allowed to access the server.  To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range.  It may take up to five minutes for this change to take effect.; </string>'

    Where does the reported Client IP come from and how do I retrieve this within my Powershell script to create the necessary rule.

    I am creating all resources in my script including the virtual network its subnet and the sql server etc.

    Thursday, August 22, 2019 9:22 AM


  • On further investigation it looks like the IP Address being used is one from the pre-defined range used by Azure within North Europe, hence I have simply created created a global rule that is deleted after the deployment of the app script is completed.

    Not sure at this moment what the impact of running the Powershell script within the Automation environment will have I'll cross that bridge when I get there.

    • Marked as answer by Andy HB Friday, August 23, 2019 9:20 AM
    Friday, August 23, 2019 9:20 AM