sending email from sql azure - sql

Hey all,
just quick question about sql azure. My App is running on windows azure and the database is on sql azure. Everything is working great. However, I would like to send email to a user, as soon as he\she became a member.I don't want to Use
- third party service
- send email from the code.
Is there any way to send email by using a trigger and stored procedure? For example: run trigger after each updated for user table and trigger will run stored procedure.
Thanks in advance . Matt

As far as I know, there is no way to send an email from SQL Azure directly. You will have to use a web, worker or VM role to actually send email. In general, sending email from Azure data centers is tricky because spam filters flag Azure IP addresses as unsafe (see https://alinirimie.sys-con.com/node/1404827). To avoid this problem, you must use a third party SMTP service (we use Amazon SES) or your own SMTP server. If you want to connect to your own SMTP server through a firewall, you can use Windows Azure Connect to establish a secure tunnel from Azure to your local network.

I realize you stated that you do not want to use a 3rd party services, but for others that might be reading this and would be open to this. Cotega allows you to send emails directly from SQL Azure.
Full disclosure, I work on Cotega.

There is some documentation on hacks you can do here: http://vpolizzi.wordpress.com/2010/09/11/database-mail-on-sql-azure/
However I think using a worker role would be more robust and maintainable.

Related

AZURE SQL Database User

I created SQL account for an application but how do I restrict or deny the same account not to connect the database using SSMS or Azure data studio by the developers since the developers can view the user information in web.config file.
Thanks,
Sandeep
You can use Azure Active Directory to authenticate your app, so that you don't need to write the username and password in config file.
With Azure AD authentication, you can centrally manage the identities of database users and other Microsoft services in one central location.
Benefits:
It provides an alternative to SQL Server authentication.
It helps stop the proliferation of user identities across servers.
It allows password rotation in a single place.
You can read more details from this document.
Basically the answer to your question is... You can't...
There is no way to identify the client of a certain connection in Azure SQL. What you can do, for example, is restrict access to a certain server using s firewall. But if your dev env is on the same machine as your SSMS that won't work because you're then blocking the dev env as well.
In that case, the best practice is to create a dev database to which all devs have access. In that case, it doesn't matter for you everyone knows the password because it's the dev database.
For production environments, you need to treat database credentials as secrets and thus make sure they are stored in a safe place. When you're using Azure, the KeyVault may be a good place to store the password. This KeyVault has a fine grained way of allowing access to secrets for individuals as well as IT systems.

How to authenticate users in a commercial environment without on-premises Windows Server equipment?

So what I need is a remote/cloud Windows Server that I can connect to using RDP (or another remote connection program) where I can create users, groups, basically everything I could do with an on-premises Server instance. What I need though is to be able to setup all the office computers to authenticate through the cloud AD. I have no clue how to do this. I cannot have a Server running on-premises, period. Just need something where I can connect each computer to the remote domain/forest, hopefully using an IP to the server, and then have the employees be able to logon to any domain-connected PC using their credentials. Thank you for any and all answers! -Scott
You need Azure Active Directory. You can control everything with remote management in the way you have described. Per the provided link, "Azure Active Directory (Azure AD) provides an easy way for businesses to manage identity and access, both in the cloud and on-premises."

Can't connect to Azure sql server or even ping

I can't connect to my Azure SQL Database that I have hosted on MS Azure.I have tried with Visual Studio and MSSM with no luck.
I can't seem to work out how I could possibly be going wrong. I allowed access to the server on all IPs.
I am using the correct login info.
I dont seem to be even able to ping the server, despite it showing no issues in the Azure interface.
The server is located at: kkbpeyaf0t.database.windows.net
I tried to connect to the URL you provided using SSMS and it gave me a login failed (which I expected), so that tells me that the database is running and that you did indeed open up the IP ranges to allow anything (which isn't a best practice, but I'm assuming you did this as part of your troubleshooting). IF the Azure SQL DB firewall was still in the way it would block immediately indicating so.
I would think that if you have the correct username and password combination it should connect. Make sure that your outbound port 1433 isn't being blocked by your own firewall (machine, work, ISP, etc.).
Azure SQL Database won't respond to pings.
Docs can be found on MSDN.

How to create a document on a server in another Lotus Notes network?

Public Domino server has a publicly available Lotus Notes database. That database has a form that an unauthenticated user can fill out and submit using his/her browser.
This publicly available form is only used for the post request and data must not be stored on that publicly available server. Instead, I need to connect to a database on an internal server and create the document there.
Obvious solution is a Lotus Script agent but when I worked on Notes, I remember non-user agents were prevented from opening databases on another server for security reasons. I certainly cannot introduce secure server setup. I need to find a way to do this that fits current setup. The servers are in two different Notes networks but mail is routed between them, so if I don't find a better solution, I will probably mail the document.
Any ideas? I have not worked with latest Notes servers. Anything in 8.5 that can help here?
In the server document on the security tab there is an Option called "Trusted Servers" if you could put the external server into that field, then the agent would be allowed to dirctly write into databases on the internal server.
If you are not able / allowed to do this, then you have to write to a "local" database (on external server) and replicate this database to internal server either by using a console command (NotesSession.SendConsoleCommand) or with the replicate method of the NotesDatabase class (not sure, if this will work due to the same security restrictions) or via scheduled replication.
If the database itself cannot be replicated on the external server, then you should use a container database and let an agent on the internal server copy the data to the internal database.
And the last possibility you already mentioned: compose the document and send it via mail. Make the target database a mailin- database and simply send you data there with NotesDocument.Send...
One of these options should solve your problem.

SQL Unique User ID and workstation

I have the following scenario:
A web application deployed over an NLB and a SQL Cluster.
In the database each table has a trigger to track activities done by users.currently the triggers are saving HostName (which is not useful in case of such web deployment).
Connection to the db is impersonated with the account "SA", Is there a possible way to obtain the
connected user or the workstation sending the request inside SQL or I need to pass User Info into the db from withing the applications Code.
The DBMS is SQL and the web application is based on .NET framework
You need to pass in the user id from the code unless you set up Kerberos pass through to use Windows Authentication. That is out of scope for this answer.
More importantly, why are you running a web app using "sa" on the SQL cluster. This is idiocy. Use a "least privilege" windows service account to run your IIS App Pool and use this to connect to SQL Server.