none
Azure Access from an API

    Question

  • Good afternoon,

    I have created a Azure Account, with a :
    • Database Server
    • Database
    Initially ( now ) a trial account.

    I have downloaded the Microsoft SQL Management Studio, and I can access the datatables successfully.
    I have also built a C++ program that can access this data as well.
    The intention is to create this API for multiple users, and multiple devices / operating systems.

    The issue I have is when I take this program and run it on another machine, it can not access the Server.

    I have also put the Azure Firewall settings to 0.0.0.0 to 255.255.255.255 to allow any IP address.

    Other computers with the API installed and different IP's can still not access the tables.
    Is there another setting somewhere else within Azure ?

    Thanks in Advance.

    Andrew

    Saturday, October 8, 2016 6:42 PM

Answers

  • Can you access the target Azure SQL Database from either of these computers via SQL Server Management Studio?

    hth
    Marcin

    Sunday, October 9, 2016 7:47 PM

All replies

  • Could this limitation possibly be because I just created this account ( this week ) and is still only a trial edition ?

    And if so, if I promote the account to a paid account, will it work then ?

    Saturday, October 8, 2016 6:44 PM
  • Review the output of the Get-AzureRmSqlServerFirewallRule (details at https://azure.microsoft.com/en-us/documentation/articles/sql-database-configure-firewall-settings-powershell/)

    Ensure that the firewall rules include the 0.0.0.0-0.0.0.0 entry if you want to connect from Azure.

    Details at https://azure.microsoft.com/en-us/documentation/articles/sql-database-firewall-configure/

    Note that there are both database and server firewalls - so make sure that the change you made applies on the server level as well

    hth
    Marcin


    Saturday, October 8, 2016 7:51 PM
  • Thanks for the response.

    Firstly, for Server :

    I have the Ports as 0.0.0.0 to 255.255.255.255 if try to put to 0.0.0.0 to 0.0.0.0, willnot be able to save, as is invalid Azure says  to turn All access to On - which is on.

    Secondly - there are no options for the database to set firewall?, only server settings.

    Thanks,

    Andrew

    Saturday, October 8, 2016 8:44 PM
  • Andrew,

    database firewall settings are configurable via T-SQL (https://azure.microsoft.com/en-us/documentation/articles/sql-database-configure-firewall-settings-tsql/ ) - but if you haven't created them, then the access should be granted based on the serve rules only

    Can you test your app from the same computer from which you can successfully connect via SSMS? If so, this would rule out the firewall as the culprit - and if so, you would want to focus on the app settings

    hth
    Marcin

    Saturday, October 8, 2016 10:54 PM
  • Andrew,

    In addition to checking the firewall rules of the server, you also need to check out the settings for the Azure network.  Depending on the model you used to deploy in Azure, Service Manager (classic) or Resource Manager, you will either have VM endpoint settings for the virtual machine or Network Security Groups (NSGs) for the VM.  One of those two may be locked down to your public IP address endpoint, which would prevent other computers from connecting if their public IP address is different.

    You can change the endpoint settings to expose whatever ports (1433?) to all source IP addresses 0.0.0.0/24.  You can do the same with a rule in the Network Security Groups.  Take in a look in the Azure portal and let me know what you see.

    -Ned

    Saturday, October 8, 2016 11:10 PM
  • Hi Thank you everyone for helping,

    I see that my Security Policy is Inherited for both the Server and database, so this is probably where it is going wrong.

    I do not know how to change these yet - looking into.

    Thanks,

    Sunday, October 9, 2016 6:25 PM
  • Narrowing Down, I add the second computer's IP address ( a different computer than the original Azure Development machine ). This Second computer has the same API, and it can not connect, even though the firewall rule for the Azure SQL server has its ip added?

    Sunday, October 9, 2016 6:44 PM
  • Andrew - is the second computer an Azure VM?

    hth
    Marcin

    Sunday, October 9, 2016 7:11 PM
  • No, not a virtual machine, a physical Windows 10 Tablet Asus Transformer (netbook?)

    Separate machine connected to internet with WIFI, and has a separate IP address

    Also tried putting same program onto another physical windows 10 machine, and with a different IP, it wont connect either.

    Eliminating WIFI as a variable.

    Thanks,

    Sunday, October 9, 2016 7:22 PM
  • Can you access the target Azure SQL Database from either of these computers via SQL Server Management Studio?

    hth
    Marcin

    Sunday, October 9, 2016 7:47 PM
  • Excellent Idea.

    Downloading and will try.

    Will advise.

    Thank you.

    Sunday, October 9, 2016 7:55 PM
  • Yes I Can connect through Microsoft SQL Server Management Studio.

    This machine has separate IP and connects to internet through WiFi.

    Now I'm really stuck, what does this mean?

    Thanks,

    Sunday, October 9, 2016 8:23 PM
  • Thank you everyone.

    I have solved this.
    Wasn't until Marcin suggested SQL on the secondary, which could connect, and my program could not.

    This meant something wrong with program - most likely

    Program is C++ with Embarcadero - XE8 ( sorry MS :)
    Component using FD Connection -
    On My development machine -
    address to server : [servername].database.windows.net
    Server : [servername]
    This worked on Development Computer but not on other machines.
    changed :
    Server to full address
    Server : [servername].database.windows.net

    And can now use this on other machines.
    Thank you everyone for all your help.

    Andrew

    Sunday, October 9, 2016 8:51 PM
  • Andrew,

    Can you expand on the environment you have built and how the API is communicating with the SQL database?  The way I understand it now, you have a single VM in Azure.  That VM is running SQL Server 20xx, and has a public IP address with port 1433 exposed.  You have written an API in C++ and you are running it locally on a desktop.  That API accesses the database on the SQL instance running on the Azure VM.  

    From the local desktop you are able to make calls against the API and it works.  From a different workstation it does not work.  

    Is that correct, or am I missing something?

    If you could review what ports and protocols the API is using to communicate with the client and database, that would probably help narrow down the issue.

    -Ned

    Sunday, October 9, 2016 8:52 PM
  • Thanks Ned, It was my program connection, outside of my development machine was different than development machine. I needed to add more details to the connection.

    Thank you.

    Sunday, October 9, 2016 8:59 PM