connect to windows azure database from VS 2012 Express - azure

I have been following this example
http://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/
and I could not connect to windows azure database. It gives me the following error
"A network-related error occurred while establishing a connection to SQL Server. The server was not found or was not accessible."
I have the IP address set, and made a firewall role already.
Any ideas :(

First test whether your ISP (Internet Provider) or corporate system administrator is not blocking outgoing connections on port 1433! This is very common issue with accessing SQL Azure from own laptop/computer.
To test firewall setting just navigate to the web management portal for your SQL Azure Instance. It has a default address:
https://[your_server_name].database.windows.net/?langid=en-us
This will open web management (Silverlight) portal for your SQL Azure Server. You can use to test whether you have correctly configured Firewall Rules on the Azure side. If you have done so, you will be able to log-in from the browser. Note that even if it uses the browser the management portal still respects the Firewall rules for the SQL Azure database.
If cannot log-in from the SQL Azure management portal, then check again your real IP address and make sure it matches the firewall rules.
If you can login from the portal, but not from Visual Studio - then check with your system administrators (or Internet provider support line) whether they have blocked outgoing connections on port 1433. If this is the case you cannot do anything, but just work from the web portal.

Related

Can connect to one Azure DB but not another

Two years ago I created a SQL Server .database.windows.net and that works fine, I can connect through the azure portal and my local SSMS.
Today I created a new SQL Server .database.windows.net
But I can not connect through SSMS or even the Azure Portal
The azure portal gives the error
A connection to the server 'youtube-mb.database.windows.net' could not be established. This might indicate an issue with your local firewall configuration or your network proxy settings.
I know it complains about a firewall but I can't believe that is the issue is due to my local firewall since one server works and the other does not. And other on premise SQL Servers connect.
I also check
the password is correct (by resetting it)
the firewall configurations in azure are the same
Minimum TLS > 1.0
Connection Policy - Default
Allow Azure services and resources access to this server
My IP whitelisted
Not sure what else to look at, especially if Quick Query is not working in the portal itself.
The firewall rule is set at the server level, so you have to add an firewall rule exception for each Azure SQL Server instance you create to access it from your PC.

Azure App Service Deploy returns (403) Forbidden with IP restriction

In Azure, I turned on IP restrictions for:
Web App (Networking > Access Restrictions)
SQL server (Firewalls and virtual networks > Add client IP)
SQL database (Set server settings)
The solution still builds locally and in DevOps (aka Team Foundation Server).
However, Azure App Service Deploy now fails:
##[error]Failed to deploy App Service.
##[error]Error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
More Information: Could not connect to the remote computer
("MYSITENAME.scm.azurewebsites.net") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer.
Error: The remote server returned an error: (403) Forbidden.
Error count: 1.
How can I deploy through the firewall?
Do I need a Virtual Network to hide Azure resources behind my whitelisted IP?
The REST site scm.azurewebsites.net must have Allow All, i.e. no restriction. Also, Same restrictions as ***.azurewebsites.net should be unchecked.
It does not need additional restriction because url access already requires Microsoft credentials. If restrictions are added, deploy will fail the firewall, hence the many complications I encountered.
I think the answer is incorrect as you might face data ex-filtration and that's the reason Microsoft provide the feature to lock down SCM portal (Kudu console)
There is also a security issue on Kudu portal as it can display the secret of your keyvault (if you use keyvault) and you don't want someone in your organisation to access the Kudu portal for example.
You have to follow this link
https://learn.microsoft.com/en-us/azure/devops/organizations/security/allow-list-ip-url?view=azure-devops
It will provide you Azure DevOPS IP range that you need to allow on the SCM Access restriction.
Update: To make it works as expected and to use App Service Access Restriction (same for an Azure Function), you need to use the Service Tags "AzureCloud" and not the Azure DevOPS IP range as it's not enough. on the Azure Pipeline logs, you can see the IP blocked so you can see that it's within the ServiceTags "AzureCloud" in the Service Tags JSON file
It's not really clear on the MS Doc but the reason is that they struggled to define a proper IP range for Azure DevOPS Pipeline so they use IPs from AzureCloud Service Tag.
https://www.microsoft.com/en-us/download/details.aspx?id=56519
In my case I was deploying using Azure DevOps and got the error. It turned out the app service where my API was being deployed to, had the box checked "Same restrictions as xxxx.azurewebsites.net", under access restrictions or IP restrictions. you need to allow scm.azurewebsites.net.
Try adding the application setting WEBSITE_WEBDEPLOY_USE_SCM with a value of false to your Azure App Service. This was able to solve my issues deploying to a private endpoint.
In my case it was because the daily quota was overpassed.
So the solution in this case is either wait or pay more (scale up) the app service
In my case this was because the wrong agent (Windows Hosting) was being used when I should have been using a self hosted internal agent... so I needed to change it at the following location

How to enable the access to Azure services in my AZURE SQL database server?

I'm trying to create a "Integration Runtime" (AZURE-SSIS type) in my data factory. (To run my SSIS packages in cloud) I already have a virtual machine (Azure SQL data base server Up and running).
While during the IR creation process I'm not able to link my AZURE SQL database SSISDB catalog to "Catalog database server endpoint" (OR) the server is not showing up in the drop down box.
In the MSDN blog it says
"Confirm that the **Allow access to Azure services** setting is enabled for the database server. This is not applicable when you use Azure SQL Database with virtual network service endpoints/Managed Instance to host SSISDB."
Could anyone know how to enable this feature ? I hope by enabling this feature I can link my server in the IR and run the packages in the cloud.
Thanks
To allow applications from Azure to connect to your Azure SQL server,
Azure connections must be enabled. When an application from Azure
attempts to connect to your database server, the firewall verifies
that Azure connections are allowed. A firewall setting with starting
and ending address equal to 0.0.0.0 indicates Azure connections are
allowed. If the connection attempt is not allowed, the request does
not reach the Azure SQL Database server.
you can do it any way, powershell, az cli, arm templates. if you go to the portal to the firewall blade, there would be a button to do that.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure
Please take a look where is located on below image.
On this documentation you will have instructions how to reach that screen.

Connect to Sql Server of Windows Azure VM from local Sql Server

I am trying to connect to my Sql server 2012 which is setup on Azure VM. I am trying to connect it from my local Sql server 2012. I have tried all these steps
http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-provision-sql-server/
But still not able to connect. I getting this error
Can Some please help me to solve this problem?
Since you're connecting to cloudnet.app domain address I assume you don't use VPN. This means:
- SQL Server authentication should be set to mixed mode
- SQL login should be created or enabled
- In case enabling SA login make sure you set the password
For connectivity part I agree with Jason's suggestions, but I would not disable firewall, since with endpoints facing public internet it is your last line of defense on the VM. Just make sure you have allow rule for the SQL Server port (most likely 1433).
Confirm the following:
You have configured the cloud service port 57500 (from the screenshot) to forward to the port that SQL is configured on, typically 1433.
Turn off the firewall within the VM. Once you get a working connection, I would reconfigure the firewall to only open the port(s) you need for security. The instructions you provided show how to open a specific port, but you should first disable the firewall to rule out a misconfiguration there.
Remote into the VM and ensure that you're able to use the management tools on that machine to make a local connection. This will help rule firewalls and the load balancer for the cloud service.

How to: Connect to Windows Azure SQL Server Database Through Windows virtual machin

Hi guys,
i created sql server database in windows azure. after i integrate this database with my application its working fine.i want to move my application also windows azure virtual machine.i created required Environment(means install java and tomcat) for this.and also allow the ip address in azure sql server database also.but it showing
Connect open connection error
while connecting database.i also allow the port number in wirewall settings but still i am not able to connect database.
please give any suggestions.
From your question it is a little bit unclear which database you're using -
If you're using 'Windows Azure SQL Database' (i.e. the PaaS version), than you need to ensure that your server's firewall, through the Windows Azure Management Portal, is configured to allow Windows Azure Services and then, of course, you need to use the fully qualified name of the server when trying to connect (i.e. ABCD.database.windows.net)
If you have deployed SQL Server as a VM on IaaS you have two options - either define an endpoint for the VM to open port 1433 (or any other port mapped to 1433 for that matter) to the outside world and then use the cloud service's DNS entry to connect to the database or define a virtual network onto which you will deploy both your database VM and your application VM. if you do the latter you will be able to refer to the database using it's private IP.
this might be somewhat useful

Resources