{"id":298,"date":"2016-09-22T05:19:11","date_gmt":"2016-09-22T12:19:11","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-apps\/custom-api-for-image-upload\/"},"modified":"2025-06-11T08:17:25","modified_gmt":"2025-06-11T15:17:25","slug":"custom-api-for-image-upload","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-apps\/custom-api-for-image-upload\/","title":{"rendered":"How to upload images from the camera control to Azure blob storage"},"content":{"rendered":"<p>We have seen several customers asking us this question- \u201cCan I upload the photos taken using the Camera control in PowerApps to an Azure blob storage?\u201d. The answer is : \u201cYes certainly, you can do that using a <a href=\"https:\/\/powerapps.microsoft.com\/en-us\/tutorials\/register-custom-api\/\" target=\"_blank\" rel=\"noopener\">Custom API in PowerApps<\/a>\u201d.\u00a0 The immediate next question is : \u201cDo you have an example for such an API?\u201d. This blog post is attempting to provide an answer to that question.<\/p>\n<p>This article explains how to create a Azure API App which takes in a image file, stores it on an Azure blob storage account and returns the URL of the image. This API can then be called from any application including PowerApps.<\/p>\n<p>The complete source code for this solution can be found at <a href=\"https:\/\/github.com\/pratapladhani\/ImageUploadAPI\" title=\"https:\/\/github.com\/pratapladhani\/ImageUploadAPI\">https:\/\/github.com\/pratapladhani\/ImageUploadAPI<\/a>.<\/p>\n<p>Lets start.<\/p>\n<hr\/>\n<h2>Create an Azure API App<\/h2>\n<p><strong>Create <\/strong>a new <strong>ASP.NET Web Application <\/strong>&gt; <strong>Azure API App <\/strong>&gt; by the name <strong><em>ImageUploadAPI<\/em><\/strong>.<\/p>\n<p>Select the <strong>Host in the cloud<\/strong> checkbox.<\/p>\n<p>\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"381\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>\u00a0<\/p>\n<p>Provide the <strong>API App Name<\/strong>, select the appropriate <strong>Subscription<\/strong>, <strong>Resource Group <\/strong>and <strong>App Service Plan <\/strong>and click on <strong>Create<\/strong>.<\/p>\n<p>\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"458\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/d352e7b5-e2a9-4d07-8bbf-400ffbf17d23.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>\u00a0<\/p>\n<p><strong>Create <\/strong>a New Class in the Controllers folder by the name \u201c<strong>AddFileParamTypes.cs<\/strong>\u201d. <strong>Replace the code <\/strong>in the file with the code given below:<\/p>\n<pre class=\"prettyprint\">using System.Collections.Generic;\nusing System.Web.Http.Description;\nusing Swashbuckle.Swagger;\nnamespace ImageUploadAPI.Controllers\n{\n    public class AddFileParamTypes : IOperationFilter\n    {\n        public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)\n        {\n            if (operation.operationId == \"UploadImage\")  \/\/ SwaggerOperation\n            {\n                operation.consumes.Add(\"multipart\/form-data\");\n                operation.parameters = new List&lt;Parameter&gt;\n                {\n                    new Parameter\n                    {\n                        name = \"file\",\n                        required = true,\n                        type = \"file\",\n                        @in = \"formData\",\n                        vendorExtensions = new Dictionary&lt;string, object&gt; { {\"x-ms-media-kind\", \"image\" } }\n                    }\n                };\n                operation.parameters.Add(new Parameter()\n                {\n                    name = \"fileName\",\n                    @in = \"query\",\n                    required = false,\n                    type = \"string\"\n                });\n            }\n        }\n    }\n}<\/pre>\n<p><strong>Create <\/strong>a New Class in the Controllers folder by the name \u201c<strong>InMemoryMultipartFormDataStreamProvider.cs<\/strong>\u201d. <strong>Replace the code<\/strong> in the file with the code given below:<\/p>\n<pre class=\"prettyprint\">using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Collections.Specialized;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Threading.Tasks;\nnamespace ImageUploadAPI.Controllers\n{\n    public class InMemoryMultipartFormDataStreamProvider : MultipartStreamProvider\n    {\n        private NameValueCollection _formData = new NameValueCollection();\n        private List&lt;HttpContent&gt; _fileContents = new List&lt;HttpContent&gt;();\n        \/\/ Set of indexes of which HttpContents we designate as form data\n        private Collection&lt;bool&gt; _isFormData = new Collection&lt;bool&gt;();\n        \/\/\/ &lt;summary&gt;\n        \/\/\/ Gets a &lt;see cref=\"NameValueCollection\"\/&gt; of form data passed as part of the multipart form data.\n        \/\/\/ &lt;\/summary&gt;\n        public NameValueCollection FormData\n        {\n            get { return _formData; }\n        }\n        \/\/\/ &lt;summary&gt;\n        \/\/\/ Gets list of &lt;see cref=\"HttpContent\"\/&gt;s which contain uploaded files as in-memory representation.\n        \/\/\/ &lt;\/summary&gt;\n        public List&lt;HttpContent&gt; Files\n        {\n            get { return _fileContents; }\n        }\n        public override Stream GetStream(HttpContent parent, HttpContentHeaders headers)\n        {\n            \/\/ For form data, Content-Disposition header is a requirement\n            ContentDispositionHeaderValue contentDisposition = headers.ContentDisposition;\n            if (contentDisposition != null)\n            {\n                \/\/ We will post process this as form data\n                _isFormData.Add(String.IsNullOrEmpty(contentDisposition.FileName));\n                return new MemoryStream();\n            }\n            \/\/ If no Content-Disposition header was present.\n            throw new InvalidOperationException(string.Format(\"Did not find required '{0}' header field in MIME multipart body part..\", \"Content-Disposition\"));\n        }\n        \/\/\/ &lt;summary&gt;\n        \/\/\/ Read the non-file contents as form data.\n        \/\/\/ &lt;\/summary&gt;\n        \/\/\/ &lt;returns&gt;&lt;\/returns&gt;\n        public override async Task ExecutePostProcessingAsync()\n        {\n            \/\/ Find instances of non-file HttpContents and read them asynchronously\n            \/\/ to get the string content and then add that as form data\n            for (int index = 0; index &lt; Contents.Count; index++)\n            {\n                if (_isFormData[index])\n                {\n                    HttpContent formContent = Contents[index];\n                    \/\/ Extract name from Content-Disposition header. We know from earlier that the header is present.\n                    ContentDispositionHeaderValue contentDisposition = formContent.Headers.ContentDisposition;\n                    string formFieldName = UnquoteToken(contentDisposition.Name) ?? String.Empty;\n                    \/\/ Read the contents as string data and add to form data\n                    string formFieldValue = await formContent.ReadAsStringAsync();\n                    FormData.Add(formFieldName, formFieldValue);\n                }\n                else\n                {\n                    _fileContents.Add(Contents[index]);\n                }\n            }\n        }\n        \/\/\/ &lt;summary&gt;\n        \/\/\/ Remove bounding quotes on a token if present\n        \/\/\/ &lt;\/summary&gt;\n        \/\/\/ &lt;param name=\"token\"&gt;Token to unquote.&lt;\/param&gt;\n        \/\/\/ &lt;returns&gt;Unquoted token.&lt;\/returns&gt;\n        private static string UnquoteToken(string token)\n        {\n            if (String.IsNullOrWhiteSpace(token))\n            {\n                return token;\n            }\n            if (token.StartsWith(\"\\\"\", StringComparison.Ordinal) &amp;&amp; token.EndsWith(\"\\\"\", StringComparison.Ordinal) &amp;&amp; token.Length &gt; 1)\n            {\n                return token.Substring(1, token.Length - 2);\n            }\n            return token;\n        }\n    }\n}<\/pre>\n<p><strong>Create <\/strong>a New Class in the Controllers folder by the name \u201c<strong>UploadedFileInfo.cs<\/strong>\u201d. <strong>Replace the code<\/strong> in the file with the code given below:<\/p>\n<pre class=\"prettyprint\">namespace ImageUploadAPI.Controllers\n{\n    public class UploadedFileInfo\n    {\n        public string FileName { get; set; }\n        public string FileExtension { get; set; }\n        public string FileURL { get; set; }\n        public string ContentType { get; set; }\n    }\n}<\/pre>\n<p><strong>Add <\/strong>the <a href=\"https:\/\/www.nuget.org\/packages\/WindowsAzure.Storage\">Windows Azure Storage Nuget Package<\/a> to the project by running the following command in the <a href=\"https:\/\/docs.nuget.org\/docs\/start-here\/using-the-package-manager-console\">Package Manager Console. <\/a><\/p>\n<pre class=\"prettyprint\">Install-Package WindowsAzure.Storage <\/pre>\n<p>\u00a0<\/p>\n<p><strong>Delete <\/strong>the <strong>ValuesController <\/strong>class from the Controllers folder<\/p>\n<p>Create a new Class in the Controllers folder by the name \u201c<strong>UploadImageController.cs\u201d.\u00a0 Replace the code<\/strong> in the file with the following code.<\/p>\n<pre class=\"prettyprint\">using System;\nusing System.IO;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Threading.Tasks;\nusing System.Web.Http;\nusing Microsoft.WindowsAzure.Storage;\nusing System.Configuration;\nusing ImageUploadAPI.Controllers;\nusing Swashbuckle.Swagger.Annotations;\nnamespace ImageUpload.Controllers\n{\n    public class UploadImageController : ApiController\n    {\n        [HttpPost]\n        [SwaggerResponse(\n            HttpStatusCode.OK,\n            Description = \"Saved successfully\",\n            Type = typeof(UploadedFileInfo))]\n        [SwaggerResponse(\n            HttpStatusCode.BadRequest,\n            Description = \"Could not find file to upload\")]\n        [SwaggerOperation(\"UploadImage\")]\n        public async Task&lt;IHttpActionResult&gt; UploadImage(string fileName = \"\")\n        {\n            \/\/Use a GUID in case the fileName is not specified\n            if (fileName == \"\")\n            {\n                fileName = Guid.NewGuid().ToString();\n            }\n            \/\/Check if submitted content is of MIME Multi Part Content with Form-data in it?\n            if (!Request.Content.IsMimeMultipartContent(\"form-data\"))\n            {\n                return BadRequest(\"Could not find file to upload\");\n            }\n            \/\/Read the content in a InMemory Muli-Part Form Data format\n            var provider = await Request.Content.ReadAsMultipartAsync(new InMemoryMultipartFormDataStreamProvider());\n            \/\/Get the first file\n            var files = provider.Files;\n            var uploadedFile = files[0];\n            \/\/Extract the file extention\n            var extension = ExtractExtension(uploadedFile);\n            \/\/Get the file's content type\n            var contentType = uploadedFile.Headers.ContentType.ToString();\n            \/\/create the full name of the image with the fileName and extension\n            var imageName = string.Concat(fileName, extension);\n            \/\/Get the reference to the Blob Storage and upload the file there\n            var storageConnectionString = ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            var storageAccount = CloudStorageAccount.Parse(storageConnectionString);\n            var blobClient = storageAccount.CreateCloudBlobClient();\n            var container = blobClient.GetContainerReference(\"images\");\n            container.CreateIfNotExists();\n            var blockBlob = container.GetBlockBlobReference(imageName);\n            blockBlob.Properties.ContentType = contentType;\n            using (var fileStream = await uploadedFile.ReadAsStreamAsync()) \/\/as Stream is IDisposable\n            {\n                blockBlob.UploadFromStream(fileStream);\n            }\n            var fileInfo = new UploadedFileInfo\n            {\n                FileName = fileName,\n                FileExtension = extension,\n                ContentType = contentType,\n                FileURL = blockBlob.Uri.ToString()\n            };\n            return Ok(fileInfo);\n        }\n        public static string ExtractExtension(HttpContent file)\n        {\n            var invalidChars = Path.GetInvalidFileNameChars();\n            var fileStreamName = file.Headers.ContentDisposition.FileName;\n            var fileName = new string(fileStreamName.Where(x =&gt; !invalidChars.Contains(x)).ToArray());\n            var extension = Path.GetExtension(fileName);\n            return extension;\n        }\n    }\n}\n<\/pre>\n<p><strong>Open <\/strong>the <strong>SwaggerConfig.cs <\/strong>file from the <strong>App_Start folder. <\/strong><\/p>\n<p><strong>Search <\/strong>for the following comment in the code<strong>.\u00a0 <\/strong><\/p>\n<p>\u00a0<\/p>\n<pre class=\"prettyprint\">\/\/ ***** Uncomment the following to enable the swagger UI *****<\/pre>\n<p>\u00a0<\/p>\n<p><strong>Uncomment <\/strong>the next 4 lines of code after the comment, once done the code should look like as follows.<\/p>\n<pre class=\"prettyprint\">\u00a0 <\/pre>\n<pre class=\"prettyprint\">                    })\n                    .EnableSwaggerUi(c =&gt;\n                    {\n<\/pre>\n<p><strong>Search <\/strong>for the following comment in the code<strong>.\u00a0 <\/strong><\/p>\n<pre class=\"prettyprint\">\/\/c.OperationFilter&lt;AddDefaultResponse&gt;();<\/pre>\n<p><strong>Add <\/strong>the following two lines of code immediately after the line<\/p>\n<pre class=\"prettyprint\">\/\/ Adding the AddFileParamTypes OperationFilter for Swagger to understand Multipart Form Data\nc.OperationFilter&lt;AddFileParamTypes&gt;();<\/pre>\n<hr\/>\n<h2>Test your API locally using the Microsoft Azure Storage Emulator<\/h2>\n<p><strong>Open <\/strong>the <strong>Web.Config <\/strong>file and find the &lt;appSettings&gt; section.<\/p>\n<p><strong>Add <\/strong>the following line in between the &lt;appSettings&gt; and &lt;\/appSettings&gt; tag like this .<\/p>\n<pre class=\"prettyprint\">  &lt;appSettings&gt;\n    &lt;add key=\"StorageConnectionString\" value=\"UseDevelopmentStorage=true\" \/&gt;\n  &lt;\/appSettings&gt;<\/pre>\n<p><strong>Start <\/strong>the <a href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/storage-use-emulator\/\">Microsoft Azure Storage Emulator<\/a> as we have used the UseDevelopmentStorage=true flag above to test.<\/p>\n<p><strong>Run <\/strong>the application by clicking <strong>F5. <\/strong>It should open the browser window with the URL http:\/\/localhost:&lt;PortNumber&gt;\/. Append the string <strong>swagger <\/strong>to the end of the URL to make it <strong>http:\/\/localhost:&lt;PortNumber&gt;\/swagger<\/strong> in the browser Address Bar and press <strong>Enter<\/strong>.<strong>\u00a0<\/strong><\/p>\n<p>You should see the swagger UI page. <strong>Expand <\/strong>by <strong>clicking <\/strong>the <strong>UploadImage <\/strong>link and <strong>click <\/strong>on the \u201c<strong>Post<\/strong>\u201d button. <strong>Browse <\/strong>for an image file from your machine. [Optionally] provide a fileName and <strong>Click <\/strong>on the \u201c<strong>Try it out!<\/strong>\u201d button.<\/p>\n<p>\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"474\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/2b1e5afb-448b-4e31-84cd-7861a63b9df4.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>You should see a 200 Response Code with a JSON in the Response Body containing the four properties similar to the screenshot below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"461\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/1ffbd14f-fea2-4b30-8b74-5896e4241872.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/>\u00a0<\/p>\n<p>\u00a0<\/p>\n<hr\/>\n<h2>Publish the API to Azure<\/h2>\n<p><strong>Create <\/strong>a new Storage account of type Blob Storage or use an existing one and add a Container of type Blob by the name <em>images<\/em>. Construct your StorageConnectionString by replace the <em>MyStorageAccountName <\/em>and <em>1234 <\/em>with your Storage account name and one of the Access keys.<\/p>\n<pre class=\"prettyprint\">DefaultEndpointsProtocol=https;AccountName=<em>MyStorageAccountName<\/em>;AccountKey=<em>1234<\/em><\/pre>\n<p>\u00a0<\/p>\n<p><strong>Change <\/strong>the value of the StorageConnectionString in the Web.Config file to the actual StorageConnectionString constructed above.<\/p>\n<p>\u00a0<\/p>\n<p><strong>Publish <\/strong>your API to Azure, by right clicking on the project and selecting <strong>Publish<\/strong>.<\/p>\n<p><strong>Test <\/strong>by appending swagger to the end of the URL for example <a href=\"https:\/\/yourapiname.azurewebsites.net\/swagger\">https:\/\/yourapiname.azurewebsites.net\/swagger<\/a>.<\/p>\n<p>You should the swagger UI page as earlier. \u00a0<strong>Expand <\/strong>by <strong>clicking <\/strong>the <strong>UploadImage <\/strong>link and <strong>click <\/strong>on the \u201c<strong>Post<\/strong>\u201d button. <strong>Browse <\/strong>for an image\u00a0 file from your machine. [Optionally] provide a fileName and <strong>Click <\/strong>on the \u201c<strong>Try it out!<\/strong>\u201d button.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"459\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/d97b8ea2-53fd-4aaf-aa8b-50174605996a.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<pre class=\"prettyprint\">You should see a 200 Response Code with a JSON in the Response Body containing the four properties similar to the screenshot below.<\/pre>\n<pre class=\"prettyprint\"><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"477\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/e1b857bc-7a1b-4bfa-b424-097bc838cbff.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/pre>\n<hr\/>\n<h2>Source Code Location<\/h2>\n<p>The complete source code for this solution can be found at <a href=\"https:\/\/github.com\/pratapladhani\/ImageUploadAPI\" title=\"https:\/\/github.com\/pratapladhani\/ImageUploadAPI\">https:\/\/github.com\/pratapladhani\/ImageUploadAPI<\/a>.<\/p>\n<hr\/>\n<h2>Download the Swagger file for registration with PowerApps<\/h2>\n<p>PowerApps requires the APIs to be <a href=\"https:\/\/powerapps.microsoft.com\/en-us\/tutorials\/register-custom-api\/\">registered using the swagger file<\/a>. Swagger UI allows us to download the swagger file directly from the browser.\u00a0 <\/p>\n<p><strong>Copy<\/strong> the URL from the Swagger UI (as shown in the image below) and <strong>paste<\/strong> it on the address bar of a <strong>new browser window<\/strong>. <img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"137\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/648f8f2f-4802-485d-b50f-ec0ead6618bf.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p><strong>Save <\/strong>the file locally in your machine by the name \u201cImageUploadAPI-swagger.json\u201d.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"41\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/817a2c6d-8fa4-4a37-9847-4baedd0fe0a7.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<hr\/>\n<h2>Register the Custom API in PowerApps using the swagger file<\/h2>\n<p><strong>Browse <\/strong>to <a href=\"https:\/\/web.powerapps.com\">https:\/\/web.powerapps.com<\/a>. Login using your work or school email id. <strong>Click <\/strong>on <strong>Manage <\/strong>on the left nav and then on <strong>Connections<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"325\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/6dbcbc0a-355f-49dd-b049-b3ff86c30e7e.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"175\"\/><\/p>\n<p>\u00a0<\/p>\n<p>Then click on <strong>New Connection <\/strong>on the top right side.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"100\" src=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/9c486a5e-d4cd-4374-8d04-85be2db88ed9.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"376\"\/><\/p>\n<p>\u00a0<\/p>\n<p>Click on <strong>Custom<\/strong> and then on <strong>New custom API.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"79\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/89a35ffb-aebe-4e3f-ac45-88b2a2d9de91.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>Give a <strong>Name \u201cImageUpload\u201d <\/strong>for your custom API. This is how you will call your API from PowerApps. <strong>Select <\/strong>the Swagger file from your local machine for <strong>Swagger API definition<\/strong>. [Optional] Add any API icon file (32X32).\u00a0 [Optional] Provide a description for your API.<\/p>\n<p><strong><\/strong>\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"393\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/765e7a64-3837-41b9-aa6b-7a1590e41090.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"416\"\/><\/p>\n<p>\u00a0<\/p>\n<p>Click on <strong>Next<\/strong>. <strong>Select <\/strong>\u201cNo Authentication\u201d as the authentication type and click on <strong>Create<\/strong>. It is <strong>not recommended <\/strong>to leave your API endpoint as \u201cNo Authentication\u201d. We shall test the API first and later I shall point to the steps for securing the API and the custom API endpoint with AAD authentication. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"170\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/b41ea95a-945b-4fb0-b16d-2936f2df3ba3.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"397\"\/><\/p>\n<hr\/>\n<h2>Create a PowerApp with Camera control <\/h2>\n<p><strong>Open <\/strong>PowerApps on your Windows 8\/10 machine (If you haven\u2019t installed PowerApps yet, you can <strong>download <\/strong>PowerApps from <a href=\"https:\/\/aka.ms\/powerappswin\">https:\/\/aka.ms\/powerappswin<\/a>). <strong>Sign-in <\/strong>using your work or school email id.\u00a0 Then click on <strong>New <\/strong>from the left nav and look for <strong>Create an app <\/strong>&gt; <strong>Blank app <\/strong>&gt; <strong>Tablet layout.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"353\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/a7a76ee1-7be6-4500-b94f-efda9a7da4c2.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>\u00a0<\/p>\n<p>This will open a blank Tablet app with a default screen. <strong>Click <\/strong>on <strong>Insert <\/strong>&gt; <strong>Media <\/strong>&gt; <strong>Camera <\/strong>to insert a camera control to the page. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"377\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/d74d5976-c79c-4846-b58a-f824a9c163ac.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>\u00a0<\/p>\n<p>Move the Camera1 control to the center of the screen. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"328\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/2923f1ec-7480-4b02-ae0d-436ec0baccd8.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"572\"\/><\/p>\n<p><strong>[Optional]<\/strong> If you are using a device with multipe cameras, you may want to have a way to switch between front and back cameras. We shall insert a Toggle Switch an bind it to the Camera control to toggle between front and back cameras. <\/p>\n<blockquote>\n<p>Click on <strong>Insert <\/strong>&gt; <strong>Controls <\/strong>&gt; <strong>Toggle <\/strong>to insert a Toggle control. Click <strong>Insert <\/strong>&gt; <strong>Text box <\/strong>to insert a Text box (label) control. Place it next to the camera and change the <strong>Text <\/strong>property for the <strong>Text box <\/strong>to <strong>&#8220;Toggle front\/back camera&#8221;<\/strong>.<\/p>\n<\/blockquote>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"138\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/61af3ed1-6427-4c19-be33-1ece48f32ab6.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"317\"\/><\/p>\n<blockquote>\n<p>With the <strong>Camera1<\/strong> control selected, change the dropdown on the top left to <strong>Camera <\/strong>and type the following formula in the Formula bar.<\/p>\n<\/blockquote>\n<blockquote>\n<pre class=\"prettyprint\">If(Toggle1.Value, 1,0)<\/pre>\n<\/blockquote>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"141\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/daa7005b-5adc-4fbe-bd26-d030f7bd6602.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>\u00a0<\/p>\n<p>Add a Text Input Box for entering the File name.\u00a0 Click <strong>Insert <\/strong>&gt; <strong>Text<\/strong> &gt;\u00a0 <strong>Text input<\/strong> to add a Text input control to the screen. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"216\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/347b7f57-0e13-497d-9b28-8d5078b1257e.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p><strong>Move <\/strong>the <strong>Text Input <\/strong>below the Camera control. <strong>Change<\/strong> the <strong>Text <\/strong>property of the <strong>Text Input <\/strong>to an empty string <strong>&#8220;&#8221;. Change <\/strong>the <strong>HintText<\/strong> property of the <strong>Text Input <\/strong>to <strong>&#8220;File name&#8221;.<\/strong>\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"381\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/22d38f3e-706e-4053-8e2a-f86bc1a60400.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"403\"\/><\/p>\n<p><strong>Click <\/strong>on<strong> File &gt; Save <\/strong>and the give a name to your app \u201cCameraUploadApp\u201d to save your app to <strong>The cloud<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"154\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/16b0b91b-9932-47ab-8268-9d631ef44721.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<hr\/>\n<h2>Use the custom API to upload the image from the Camera control<\/h2>\n<p>Add the Data source for the custom API in the PowerApps app. Click on <strong>Content<\/strong> &gt; <strong>Data Sources<\/strong> &gt; <strong>Add data source<\/strong> button from the right pane. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"359\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/a0fb0add-351e-4658-b810-4ccf4da766d8.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>Click on <strong>Add connection.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"108\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/0ad09f75-b53e-4655-8cd8-e2ead900670f.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"320\"\/><\/p>\n<p>Select the <strong>ImageUpload<\/strong> API that you created earlier and click on <strong>Connect <\/strong>to add it to the app. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"188\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/fe96c73f-2cbe-4e44-b49f-ad65612dc8c1.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"376\"\/><\/p>\n<p>\u00a0<\/p>\n<p>Now we shall use a formula to upload the camera\u2019s image using the api and collect the output file path to a static collection. <\/p>\n<p><strong>Click <\/strong>on the <strong>Camera control <\/strong>then click on <strong>Action <\/strong>&gt; <strong>OnSelect <\/strong>and enter the following formula:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"209\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/4ae2a031-567b-4a36-9ee9-6d3e018faf23.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<pre class=\"prettyprint\">Collect(MyPictures, {URL:ImageUploadAPI.UploadImage(Camera1.Photo, {fileName: TextInput1.Text}).FileURL, Name:TextInput1.Text, Time:Now()})<\/pre>\n<p>This formula adds passes the current Camera picture and the text from the Text Input box to the API and adds the output FileURL to a new collection with these three columns : URL, Name &amp; Time. It also assigns the same Text Input text to the Name and assigns the current time to the Time column. <\/p>\n<p>Lets now insert a Gallery below to display this new collection.<\/p>\n<p><strong>Click<\/strong> on <strong>Insert <\/strong>&gt; <strong>Gallery <\/strong>&gt; Select the third item on the first row &#8211; Horizontal Image Gallery <strong>With Text <\/strong>to add a gallery to the screen. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"154\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/771305d2-5b9c-4c69-9d9b-4a6943c15f0f.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>Position it below the Camera Control and resize it to use the full width of the screen.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"349\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/00e7fcc1-565c-4524-b066-4e770cc8decd.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>With the <strong>Gallery1 <\/strong>selected, <strong>change <\/strong>the <strong>Items <\/strong>property from <strong>ImageGallerySample <\/strong>to <strong>MyPictures.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"64\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/e2d63d17-3344-4c64-b36c-af2beeb75646.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"609\"\/><\/p>\n<p><strong>Click <\/strong>on the <strong>Preview the app\u00a0 <\/strong>icon on the <strong>top right <\/strong>OR press F5 to <strong>Preview <\/strong>the app. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"91\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/f1197a19-6ec6-46ca-ad0e-38180fa5fe08.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"275\"\/><\/p>\n<p>Enter the name of the image and then <strong>click <\/strong>on the Camera to execute the upload. Change the name of the image and click on the Camera again to upload a new image. <\/p>\n<p>You should see the newly uploaded images in the gallery below.\u00a0 Select the Gallery and use the right nav to modify which columns bind to which controls. Select the URL, Name &amp; Time respectively for the Image &amp; and the two text boxes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"298\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/1ea94034-a4c3-42f4-b6f0-9b229e709536.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"338\"\/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"281\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/a920fbfa-e9dc-4f89-bbcb-951a6aeda8dd.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<p>\u00a0<\/p>\n<p>You have successfully uploaded the images to the blob storage. You can verify that with <a href=\"http:\/\/storageexplorer.com\/\">Azure Storage Explorer<\/a> as well.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"133\" src=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/20b48f3e-349a-410b-969a-6f579d17de85.png\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 0px auto; display: block; padding-right: 0px; border-top-width: 0px\" title=\"image\" width=\"610\"\/><\/p>\n<hr\/>\n<h2>[Optional but recommended] Secure the API app and the custom API with Azure Active Directory<\/h2>\n<p>Please follow <a href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-service-mobile-how-to-configure-active-directory-authentication\/\">this article<\/a> to configure AAD for the API App. <\/p>\n<p>Once completed <a href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-service-mobile-how-to-configure-active-directory-authentication\/\">follow this tutorial<\/a> for configuring AAD authentication for the custom API.<\/p>\n<p>In a subsequent blog post, I\u2019ll try to show all the steps for securing both the API App as well as protecting the custom API also with AAD. <\/p>\n<hr\/>\n<h2>Feedback welcome<\/h2>\n<p>Hope this is helpful. Looking forward to the great scenarios that you all with build using PowerApps. <\/p>\n<p>Please share your feedback using the comments below.\u00a0 Also do suggest other topics that you would like us to blog about.\u00a0 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article explains how to create a Azure API App which takes in an image file, stores it on a Azure blob storage account and returns the URL of the image. This API can then be called from any application including PowerApps.<\/p>\n","protected":false},"author":100,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ms_queue_id":[],"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","_alt_title":"","ms-ems-related-posts":[],"footnotes":""},"audience":[3378],"content-type":[],"job-role":[],"product":[3473],"property":[],"topic":[3421],"coauthors":[2347],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","audience-it-professional","product-power-apps","topic-application-modernization"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to upload images from the camera control to Azure blob storage - Microsoft Power Platform Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to upload images from the camera control to Azure blob storage - Microsoft Power Platform Blog\" \/>\n<meta property=\"og:description\" content=\"This article explains how to create a Azure API App which takes in an image file, stores it on a Azure blob storage account and returns the URL of the image. This API can then be called from any application including PowerApps.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-apps\/custom-api-for-image-upload\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Power Platform Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-22T12:19:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-11T15:17:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png\" \/>\n<meta name=\"author\" content=\"Pratap Ladhani\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pratap Ladhani\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/\"},\"author\":[{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/author\/pratap-ladhani\/\",\"@type\":\"Person\",\"@name\":\"Pratap Ladhani\"}],\"headline\":\"How to upload images from the camera control to Azure blob storage\",\"datePublished\":\"2016-09-22T12:19:11+00:00\",\"dateModified\":\"2025-06-11T15:17:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/\"},\"wordCount\":1631,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/\",\"name\":\"How to upload images from the camera control to Azure blob storage - Microsoft Power Platform Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png\",\"datePublished\":\"2016-09-22T12:19:11+00:00\",\"dateModified\":\"2025-06-11T15:17:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#primaryimage\",\"url\":\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png\",\"contentUrl\":\"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to upload images from the camera control to Azure blob storage\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\",\"name\":\"Microsoft Power Platform Blog\",\"description\":\"Innovate with Business Apps\",\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\",\"name\":\"Microsoft Power Platform Blog\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png\",\"contentUrl\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png\",\"width\":194,\"height\":145,\"caption\":\"Microsoft Power Platform Blog\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/person\/b65835b61629a2fd09f24a46fceb2bff\",\"name\":\"Pratap Ladhani\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/5618b02062e59f576de7da01b4a7df3f64188961e5588a611d8d09b7606c550f?s=96&d=mm&r=gef2fe6828f30df80244cfd43b7ca6b57\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5618b02062e59f576de7da01b4a7df3f64188961e5588a611d8d09b7606c550f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5618b02062e59f576de7da01b4a7df3f64188961e5588a611d8d09b7606c550f?s=96&d=mm&r=g\",\"caption\":\"Pratap Ladhani\"},\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/author\/pladhani\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to upload images from the camera control to Azure blob storage - Microsoft Power Platform Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/","og_locale":"en_US","og_type":"article","og_title":"How to upload images from the camera control to Azure blob storage - Microsoft Power Platform Blog","og_description":"This article explains how to create a Azure API App which takes in an image file, stores it on a Azure blob storage account and returns the URL of the image. This API can then be called from any application including PowerApps.","og_url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-apps\/custom-api-for-image-upload\/","og_site_name":"Microsoft Power Platform Blog","article_published_time":"2016-09-22T12:19:11+00:00","article_modified_time":"2025-06-11T15:17:25+00:00","og_image":[{"url":"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png","type":"","width":"","height":""}],"author":"Pratap Ladhani","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Pratap Ladhani","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#article","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/"},"author":[{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/author\/pratap-ladhani\/","@type":"Person","@name":"Pratap Ladhani"}],"headline":"How to upload images from the camera control to Azure blob storage","datePublished":"2016-09-22T12:19:11+00:00","dateModified":"2025-06-11T15:17:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/"},"wordCount":1631,"commentCount":0,"publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#primaryimage"},"thumbnailUrl":"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/","name":"How to upload images from the camera control to Azure blob storage - Microsoft Power Platform Blog","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#primaryimage"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#primaryimage"},"thumbnailUrl":"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png","datePublished":"2016-09-22T12:19:11+00:00","dateModified":"2025-06-11T15:17:25+00:00","breadcrumb":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#primaryimage","url":"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png","contentUrl":"https:\/\/pwrappscdn.azureedge.net\/mediahandler\/blog\/media\/PowerApps\/blog\/86e9cc23-ee32-410c-8cc5-439ed14f8ee0.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/2016\/09\/22\/custom-api-for-image-upload\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/"},{"@type":"ListItem","position":2,"name":"How to upload images from the camera control to Azure blob storage"}]},{"@type":"WebSite","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/","name":"Microsoft Power Platform Blog","description":"Innovate with Business Apps","publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization","name":"Microsoft Power Platform Blog","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","contentUrl":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","width":194,"height":145,"caption":"Microsoft Power Platform Blog"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/person\/b65835b61629a2fd09f24a46fceb2bff","name":"Pratap Ladhani","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5618b02062e59f576de7da01b4a7df3f64188961e5588a611d8d09b7606c550f?s=96&d=mm&r=gef2fe6828f30df80244cfd43b7ca6b57","url":"https:\/\/secure.gravatar.com\/avatar\/5618b02062e59f576de7da01b4a7df3f64188961e5588a611d8d09b7606c550f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5618b02062e59f576de7da01b4a7df3f64188961e5588a611d8d09b7606c550f?s=96&d=mm&r=g","caption":"Pratap Ladhani"},"url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/author\/pladhani\/"}]}},"bloginabox_animated_featured_image":null,"bloginabox_display_generated_audio":false,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Power Platform Blog","distributor_original_site_url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts\/298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/users\/100"}],"replies":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/comments?post=298"}],"version-history":[{"count":1,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts\/298\/revisions"}],"predecessor-version":[{"id":128791,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/posts\/298\/revisions\/128791"}],"wp:attachment":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/media?parent=298"}],"wp:term":[{"taxonomy":"audience","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/audience?post=298"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/content-type?post=298"},{"taxonomy":"job-role","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/job-role?post=298"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/product?post=298"},{"taxonomy":"property","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/property?post=298"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/topic?post=298"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/coauthors?post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}