<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Prakamya Aishwarya on Medium]]></title>
        <description><![CDATA[Stories by Prakamya Aishwarya on Medium]]></description>
        <link>https://medium.com/@prakamya?source=rss-879961b9972e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*enbGOSotocw5K9d0</url>
            <title>Stories by Prakamya Aishwarya on Medium</title>
            <link>https://medium.com/@prakamya?source=rss-879961b9972e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 08:44:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prakamya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Fail activity in Azure Data Factory]]></title>
            <link>https://prakamya.medium.com/fail-activity-in-azure-data-factory-4860194bca7b?source=rss-879961b9972e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4860194bca7b</guid>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[fail]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-data-engineer]]></category>
            <category><![CDATA[azure-data-factory]]></category>
            <dc:creator><![CDATA[Prakamya Aishwarya]]></dc:creator>
            <pubDate>Wed, 13 Oct 2021 16:58:06 GMT</pubDate>
            <atom:updated>2021-10-13T17:45:11.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dmpUDtu_7ot60Npc.png" /></figure><p>Microsoft has finally come up with a long awaited activity for explicitly failing ADF pipelines. This will allow you to fail the pipeline and will provide handy properties for error code and error message which can be used in your error handling logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*qwmQdGbp1rJQecw9UtEAeg.png" /></figure><p>The activity is currently in preview and you can read more about it in the official <a href="https://docs.microsoft.com/en-us/azure/data-factory/control-flow-fail-activity">documentation</a>.</p><p>If you have been developing data pipelines in ADF, you would have come across situations where you wanted to fail your pipeline based on a particular condition. There was not a direct solution to this before and we had to use workarounds using <a href="https://stackoverflow.com/a/52829367">stored procedures</a> or <a href="https://stackoverflow.com/a/69212435">set variable</a> activities.</p><p>This will no longer be the case and you will be able to use the fail activity once it comes in public preview/ GA. This will not only save time in designing data pipelines but will also increase their understandability/ readability by eliminating the workarounds.</p><blockquote>If you are unaware of what preview/public preview and GA means, these are just phases in a product/feature lifecycle. You can read <a href="https://docs.microsoft.com/en-us/learn/modules/describe-service-life-cycle-microsoft-365/2-private-public-general-availability">here</a>.</blockquote><p>If you would like to connect with me, you can find me on Linkedin- <a href="https://www.linkedin.com/in/prakamya-aishwarya/">Prakamya Aishwarya.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4860194bca7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accessing Databricks REST API using service principal]]></title>
            <link>https://prakamya.medium.com/accessing-databricks-rest-api-using-service-principal-6da4f03b389f?source=rss-879961b9972e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6da4f03b389f</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[azure-databricks]]></category>
            <category><![CDATA[azure-active-directory]]></category>
            <dc:creator><![CDATA[Prakamya Aishwarya]]></dc:creator>
            <pubDate>Mon, 14 Jun 2021 15:34:31 GMT</pubDate>
            <atom:updated>2021-10-13T17:16:40.312Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*izV1ymSIQy3YITJeqBH7gg.png" /></figure><p>This article is focused around accessing the Azure Databricks REST API using <strong>Service Principal(SP) certificate or secret</strong> for authentication. If you are looking for authenticating as a user please refer to Microsoft’s <a href="https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/authentication">official documentation</a>.</p><p>You should also go through <a href="https://kaabachi.io/ways-to-authenticate-azure-databricks-api/">this article</a> by <a href="https://medium.com/@akaabachi">Amine Kaabachi</a> on <em>‘Ways to authenticate Azure Databricks REST API’. </em>It is a very good read and provides details on various authentication options available and some rules for you to decide which one you should use.</p><p>Another good resource, that I have taken help from is this <a href="https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/cb88462d12af0ce222a70f474c1347918d34ded3/sample/confidential_client_certificate_sample.py">git hub repository</a>. Some code excerpts have directly been picked from here.</p><blockquote>In our examples we have made use of client certificate as the credential. If you are using client secret, you can simply pass them as any other password in place of the client_credential.</blockquote><p>Accessing Azure Databricks REST API using service principal requires two things-</p><ol><li>Authentication</li><li>The SP which is authenticating should be a databricks workspace user (we can call this authorization)</li></ol><p>If your SP is not yet a workspace user, we will be discussing on how to add it. You can get the list of databricks workspace users in the databricks UI or you can use the <a href="https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/scim/scim-sp#get-service-principals">SCIM API</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*78jyIfip0lqvc99KUyK9XQ.png" /><figcaption>Users can be found under workspace in the Databricks UI</figcaption></figure><h3>Authentication-</h3><p>For authenticating using service principal, we first obtain an <a href="https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token#--get-an-azure-active-directory-access-token">Azure Active Directory (aad)</a> token for the SP and then use this token while sending the API request. For obtaining the aad token, we will use the Microsoft Authentication Library (MSAL). (azure identity package has also been used for creating client credential but this can be skipped..more on this in the code)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e2349c39d6be805a5270e3aeeea27e20/href">https://medium.com/media/e2349c39d6be805a5270e3aeeea27e20/href</a></iframe><p>MSAL makes use of <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow">Oauth 2.0 client credential flow</a> which in-turn uses either the SP secret or the SP certificate (you may know these as client secret or client certificate) to obtain the aad token.</p><h3>Authorization-</h3><p>Once we have got the access token, we need to make sure that our SP should be present as a workplace user. If your service principal is already a workspace user, you can skip this part and directly make the API request.</p><p>To add our SP as a workspace user, we have two options-</p><ol><li>Use our SP management privileges to add itself as a workspace user. (This requires the SP to have ‘Contributor’ or higher role for databricks workspace resource.)</li><li>Use SCIM API to add SP as a workspace user.</li></ol><blockquote>I would recommend to use the second approach as the first approach requires a contributor role for the SP which might not be given in production environments due to security concerns. This will also violate the least privilege principle.</blockquote><h3>1.Adding using SP management privileges-</h3><p><a href="https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token#--api-access-for-service-principals-that-are-not-workspace-users">Link to Microsoft documentation</a></p><p>We use this method when the service principal is not defined as a user, and we want to add it automatically as an admin user while making the API request.</p><ol><li>Make sure the SP has ‘Contributor’ or ‘Owner’ role for the databricks workspace resource.</li><li>Acquire the management token for the SP.</li><li>Send this management token and the SP aad token obtained earlier in the header while making the desired request.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de67f8e4f52dec2d120d747504053019/href">https://medium.com/media/de67f8e4f52dec2d120d747504053019/href</a></iframe><blockquote>Once we make the above API request, our SP get added as a user and subsequent calls can be made directly, i.e without the management token.</blockquote><h3>2. Adding using SCIM API-</h3><p><a href="https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/scim/scim-sp#add-service-principal">Link to Microsoft documentation</a></p><p><a href="https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/scim/scim-sp">SCIM</a> for service principal allows you to manage Azure Active Directory service principals in Azure databricks.</p><ol><li>Get aad for an databricks admin</li><li>Use this aad to make the below API request.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c87b9190a1007f09848e8df03546c8e1/href">https://medium.com/media/c87b9190a1007f09848e8df03546c8e1/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/349202a56880a04abedd149e1a8a7c04/href">https://medium.com/media/349202a56880a04abedd149e1a8a7c04/href</a></iframe><p>Once this is done, make the desired API request using the SP aad obtained earlier.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d1f25e3aef9b331fbcf1e78c3915140/href">https://medium.com/media/1d1f25e3aef9b331fbcf1e78c3915140/href</a></iframe><p>The entire piece looks like this-</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bea6db7a9c7d971eac3a748ca74bd2c2/href">https://medium.com/media/bea6db7a9c7d971eac3a748ca74bd2c2/href</a></iframe><h3>Summary</h3><p>In this article we established connectivity to Azure Databricks using REST API. There are a number of operations that can be performed on databricks this way including — create, submit and monitor jobs, import, export and delete workspace objects and <a href="https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/">more</a>.</p><p>If there is something inaccurate or something that can be improved, please leave a response.</p><p>If you would like to connect with me, you can find me on Linkedin- <a href="https://www.linkedin.com/in/prakamya-aishwarya/">Prakamya Aishwarya.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6da4f03b389f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>