Listing Azure SQL Database Users and Roles

Review

In a continuation on yesterday’s article

I thought we should touch upon how we can retrieve a list of users and their assigned roles from an Azure SQL Database Instance.

None of this is rocket science, it is more a question of being aware of what system tables and stored procedures exists.  So let’s look at each aspect:

  • List of Azure SQL Database Users
  • List of Database Users by Role

Continue reading

Adding New Users To An Azure Database

Add User

Recently, I’ve been doing much more work involving Azure SQL databases.

In one instance, I was reviewing the security setup of a client’s existing web application and noticed that they were using the default Microsoft Azure account to connect to the database.  I’ve seen this multiple times.  It is quite natural to setup the Azure Resource, deploy the Azure Database and simply use the account you have by default.  That said, there is a security concern for me with such a setup, for a couple of reasons, mainly:

  • Such a user can actually alter any aspect the database itself (and the master database as well) and no user should ever have such capabilities.
  • If ever compromised, say a hackers gains access to the app’s config file, they can actually log into the Azure Portal and do anything they want.

So I logged in and created a new SQL Login User just for their web application to use, thus limiting, as much as possible, any potential damage that could occur through the web app itself.

Creating a New Azure SQL Database User

It’s actually remarkably easy to create a new login user and only takes 3-4 simple SQL commands.
Continue reading

Getting Image Properties (Exif Metadata) Using FreeImage

Anyone following this blog knows that I’ve recently released several examples of how one can get a single exif property or all the exif properties of an image using a variety of techniques.

 

There was one more tool in my toolbox that I had used in the past that I wished to explore and see how it might be used.  The tool being FreeImage.  It is an extremely powerful image library!  I used it previously to create my

So let us briefly explore what FreeImage can offer us in this context.

Continue reading

Something I learned Today, Text Messages Are Evil!

Text Messaging

This one is going to be a brief post today, but I’m still hoping it might save someone out there some frustrations.

I have been working on an Azure database with a 3rd party and created some new users for them. We always, in the past that is, would send the user name via e-mail and password via text message. We’ve done so for a couple years now. So I did so and sent off the necessary credentials. A day or so later, they contacted me to validate because it wouldn’t work for them. So I logged on using SSMS without issue. They asked me to try the new Azure Query page and that worked fine for me as well.

Continue reading

Adding a Watermark to an Image Using The GDI+ API

This is my 6th and final article in my series looking at using the GDI+ API(s) to working with images:

Today, I decided to demonstrate how you can add a textual watermark to an image.

GDI+ API(s) offer a full range of capabilities that go well beyond this article and it can draw shapes (rectangle, circles, ellipses, …) and much, much more!  So if you need more advanced editing capabilities do look further into GDI+ as it most probably will be able to do the job.

The Code

To write on an image we will use the GdipDrawString function, but to do so we first have to use several other GDI+ API functions to define the font, font styles and then also define a brush to draw it with.

Enough talk, here’s the code.

Continue reading

Creating/Setting an Image Property Using The GDI+ API

This is my 5th article exploring how we can use the GDI+ API(s) within VBA to work with image files and their properties.  Below are my previous articles:

Today, we will explore how we can create, or set, a property!

The Code

The concept here is pretty straightforward (the code not so much!) we simply need to use the GdipSetPropertyItem function to, you guessed it, set the property with a value.  Then issue here is that we have to pass the type of property, convert the value into the proper format and finally build a PropertyItem that we pass to the function.  Thus, we need to create a few helper functions.

Enough talk, here’s the code.

Continue reading

Deleting All an Image’s Properties Using The GDI+ API

This is another post in a series of posts relating to using the GDI+ API to work with images.  You can refer to my earlier articles:

Today, I thought, like I did for retrieving properties, I’d show you how you can delete all of an image’s properties in one shot.  This can be useful when posting images online or providing them to other sources to limit the information they can retrieve from it (GPS location, Date/Time, …).

The Code

To make this happen, first I retrieve the complete list of image properties using GdipGetAllPropertyItems function and then simply iterate through them deleting them one by one using the GdipRemovePropertyItem function. That said, like when deleting a single property, once you alter the image, you need to save the changes and to do so we use the GdipSaveImageToFile function. The issue here, complicating our life unnecessarily is the fact that GdipSaveImageToFile won’t allow overwriting/saving the currently open image file. So we have to create a temp image with the changes, close the image and then copy it over. Enough talk, here’s the code.

Continue reading

Deleting an Image’s Property Using The GDI+ API

Up until now, in my 2 prior articles, we seen how we can read a single property or get all an images properties:

Today, I’m going to start showing you the real power of GDI+, we are going to examine deleting an image’s property.

The Code

The entire process revolves around the GdipRemovePropertyItem function.  That said, once you alter the image, then you need to save it and to do so we use the GdipSaveImageToFile function.  The issue here, complicating our life unnecessarily is the fact that GdipSaveImageToFile won’t allow overwriting/saving the currently open image file.  So we have to create a temp image with the changes, close the image and then copy it over.  Enough talk, here’s the code.

Continue reading

Getting All of an Image’s Properties Using The GDI+ API

Continuing on my multipart series on using the GDI+ APIs, after looking at how we can retrieve a single property as discussed in my previous article

I thought I’d explore retrieving all of the available properties.

Continue reading

Getting a Specific Image Property Using The GDI+ API

I thought I’d look at another approach to retrieving information about images.  Previously, I demonstrated how one can get file properties (including images) by using plain VBA or PowerShell:

 

Today, however, I thought I’d demonstrate using the GDI Plus API.  This will be Part 1 in a series of posts on the GDI Plus API.  It is a very complex and versatile API, so I am breaking it up into digestible pieces of information.

The GDI Plus API

The GDI Plus API can do much, much more than retrieving information about an image!  It can for instance, edit an image (watermark anyone?!), you can even use it to alter applications, dialogs, …  This is why it is more complex to use, because it is very complex!

I won’t bore you with tons of talk, here’s the code!

Continue reading