<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Azure &#8211; Kemal Burak Yılmaz</title>
	<atom:link href="http://www.kemalburakyilmaz.com/category/azure/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kemalburakyilmaz.com</link>
	<description>Unutma Unutturma</description>
	<lastBuildDate>
	Mon, 04 Jan 2021 11:10:36 +0000	</lastBuildDate>
	<language>tr</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.1.8</generator>
	<item>
		<title>Asp.net Mvc Azure AD Authentication</title>
		<link>http://www.kemalburakyilmaz.com/asp-net-mvc-azure-ad-authentication/</link>
				<pubDate>Fri, 29 Mar 2019 14:16:40 +0000</pubDate>
		<dc:creator><![CDATA[Burak Yılmaz]]></dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[Azure]]></category>

		<guid isPermaLink="false">http://www.kemalburakyilmaz.com/?p=591</guid>
				<description><![CDATA[Öncelikle uygulamamızı Azure üzerinde ekliyoruz. &#160; Ardından bilgileri giriyoruz. Burada “Oturum Açma URL” bilgisi önemli. Login olduktan sonra uygulamamızda açılmasını istediğimiz sayfa bilgisi &#160; Uygulamamızı Azure’a tanımladık. Bundan sonra kodlarımızı düzenleyeceğiz. Onun için de Microsoft’un örnek kodları ve örnek projeyi paylaştığı “ Uygulama kayıtları (Önizleme)” menüsüne gidip, hangi tipte proje yapacaksak seçiyoruz. Açılan sayfadaki kodları [&#8230;]]]></description>
								<content:encoded><![CDATA[<p>Öncelikle uygulamamızı Azure üzerinde ekliyoruz.</p>
<p><img class="wp-image-586 aligncenter" src="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1-300x151.png" alt="" width="733" height="369" srcset="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1-300x151.png 300w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1-768x387.png 768w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1-810x408.png 810w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1.png 1000w" sizes="(max-width: 733px) 100vw, 733px" /></p>
<p>&nbsp;</p>
<p>Ardından bilgileri giriyoruz. Burada “Oturum Açma URL” bilgisi önemli. Login olduktan sonra uygulamamızda açılmasını istediğimiz sayfa bilgisi</p>
<p><img class="wp-image-587 aligncenter" src="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/2-300x269.png" alt="" width="534" height="479" srcset="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/2-300x269.png 300w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/2-768x688.png 768w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/2-810x726.png 810w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/2.png 1000w" sizes="(max-width: 534px) 100vw, 534px" /></p>
<p>&nbsp;</p>
<p>Uygulamamızı Azure’a tanımladık. Bundan sonra kodlarımızı düzenleyeceğiz. Onun için de Microsoft’un örnek kodları ve örnek projeyi paylaştığı “ Uygulama kayıtları (Önizleme)” menüsüne gidip, hangi tipte proje yapacaksak seçiyoruz.</p>
<p><img class="wp-image-588 aligncenter" src="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/3-300x143.png" alt="" width="574" height="274" srcset="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/3-300x143.png 300w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/3-768x366.png 768w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/3-810x386.png 810w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/3.png 1000w" sizes="(max-width: 574px) 100vw, 574px" /></p>
<p>Açılan sayfadaki kodları uygulamamıza ekliyoruz. Yukarıda gördüğümüz id bilgilerini Web.config’e ekliyoruz ilk olarak.</p>
<p>&nbsp;</p>
<pre class="brush: plain; title: ; notranslate">
 &lt;appSettings&gt;
        &lt;add key = &quot;ClientId&quot; value=&quot;f5697701-3d73-4b85-b905-0ca2a698b127&quot; /&gt; //Uygulama kimliği
        &lt;add key = &quot;Tenant&quot; value=&quot;*****-099f-44ac-b918-2a8b72110b59&quot; /&gt; //Dizin kimliği
        &lt;add key = &quot;Authority&quot; value=&quot;https://login.microsoftonline.com/{0}/v2.0&quot; /&gt;
        &lt;add key = &quot;redirectUri&quot; value=&quot;http://localhost:59740/Login/&quot; /&gt; //Uygulamayı tanımlarken girdiğimiz Oturum Açma URL bilgisi
    &lt;/appSettings&gt;
</pre>
<p>&nbsp;</p>
<h4 id="5116" class="graf graf--h4 graf-after--pre"><strong class="markup--strong markup--h4-strong">Sonra uygulamamıza Nuget’den aşağıdaki paketleri indiriyoruz. Yalnız bunların son versiyonlarını indirince çalıştıramadım. 4.0.0 versiyonlarını indirdiğimde düzgün çalıştı.</strong></h4>
<p id="bd37" class="graf graf--p graf-after--h4">Install-Package Microsoft.Owin.Security.OpenIdConnect</p>
<p id="add6" class="graf graf--p graf-after--p">Install-Package Microsoft.Owin.Security.Cookies</p>
<p id="5bd5" class="graf graf--p graf-after--p">Install-Package Microsoft.Owin.Host.SystemWeb</p>
<p id="455d" class="graf graf--p graf-after--p">Uygulamamızın ana dizine Startup.cs sınıfnı ekliyoruz ve aşağıdaki kodları yazıyoruz.</p>
<p>&nbsp;</p>
<p><img class=" wp-image-589 aligncenter" src="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/4-300x199.png" alt="" width="513" height="340" srcset="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/4-300x199.png 300w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/4-768x510.png 768w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/4-810x538.png 810w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/4.png 1000w" sizes="(max-width: 513px) 100vw, 513px" /></p>
<p>&nbsp;</p>
<pre class="brush: csharp; title: ; notranslate">

    public class Startup
    {
        // The Client ID is used by the application to uniquely identify itself to Azure AD.
        string clientId = System.Configuration.ConfigurationManager.AppSettings[&quot;ClientId&quot;];
        // RedirectUri is the URL where the user will be redirected to after they sign in.
        string redirectUri = System.Configuration.ConfigurationManager.AppSettings[&quot;RedirectUri&quot;];
        // Tenant is the tenant ID (e.g. contoso.onmicrosoft.com, or 'common' for multi-tenant)
        static string tenant = System.Configuration.ConfigurationManager.AppSettings[&quot;Tenant&quot;];
        // Authority is the URL for authority, composed by Azure Active Directory v2 endpoint and the tenant name (e.g. https://login.microsoftonline.com/contoso.onmicrosoft.com/v2.0)
        string authority = String.Format(System.Globalization.CultureInfo.InvariantCulture, System.Configuration.ConfigurationManager.AppSettings[&quot;Authority&quot;], tenant);
        /// 

&lt;summary&gt;
        /// Configure OWIN to use OpenIdConnect
        /// &lt;/summary&gt;


        /// &lt;param name=&quot;app&quot;&gt;&lt;/param&gt;
        public void Configuration(IAppBuilder app)
        {
            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
            app.UseCookieAuthentication(new CookieAuthenticationOptions());
            app.UseOpenIdConnectAuthentication(
                new OpenIdConnectAuthenticationOptions
                {
                    // Sets the ClientId, authority, RedirectUri as obtained from web.config
                    ClientId = clientId,
                                Authority = authority,
                                RedirectUri = redirectUri,
                    // PostLogoutRedirectUri is the page that users will be redirected to after sign-out. In this case, it is using the home page
                    PostLogoutRedirectUri = redirectUri,
                                Scope = OpenIdConnectScope.OpenIdProfile,
                    // ResponseType is set to request the id_token - which contains basic information about the signed-in user
                    ResponseType = OpenIdConnectResponseType.IdToken,
                    // ValidateIssuer set to false to allow personal and work accounts from any organization to sign in to your application
                    // To only allow users from a single organizations, set ValidateIssuer to true and 'tenant' setting in web.config to the tenant name
                    // To allow users from only a list of specific organizations, set ValidateIssuer to true and use ValidIssuers parameter
                    TokenValidationParameters = new TokenValidationParameters()
                                {
                                    ValidateIssuer = false
                                },
                    // OpenIdConnectAuthenticationNotifications configures OWIN to send notification of failed authentications to OnAuthenticationFailed method
                    Notifications = new OpenIdConnectAuthenticationNotifications
                                {
                                    AuthenticationFailed = OnAuthenticationFailed
                                }
                }
            );
        }
        /// 

&lt;summary&gt;
        /// Handle failed authentication requests by redirecting the user to the home page with an error in the query string
        /// &lt;/summary&gt;


        /// &lt;param name=&quot;context&quot;&gt;&lt;/param&gt;
        /// &lt;returns&gt;&lt;/returns&gt;
        private Task OnAuthenticationFailed(AuthenticationFailedNotification&lt;OpenIdConnectMessage, OpenIdConnectAuthenticationOptions&gt; context)
        {
            context.HandleResponse();
            context.Response.Redirect(&quot;/?errormessage=&quot; + context.Exception.Message);
            return Task.FromResult(0);
        }
    }

</pre>
<p>Login işlemini yöneteceğimiz sayfayı da aşağıdaki şekilde düzenleyince işlem tamamdır.</p>
<p><img class="wp-image-590 aligncenter" src="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/5-300x200.png" alt="" width="635" height="423" srcset="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/5-300x200.png 300w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/5-768x512.png 768w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/5-810x540.png 810w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/5.png 888w" sizes="(max-width: 635px) 100vw, 635px" /></p>
]]></content:encoded>
										</item>
		<item>
		<title>Azure Storage File Upload</title>
		<link>http://www.kemalburakyilmaz.com/azure-storage-file-upload/</link>
				<pubDate>Fri, 29 Mar 2019 13:43:32 +0000</pubDate>
		<dc:creator><![CDATA[Burak Yılmaz]]></dc:creator>
				<category><![CDATA[Azure]]></category>

		<guid isPermaLink="false">http://www.kemalburakyilmaz.com/?p=579</guid>
				<description><![CDATA[Öncelikle Azure’da Depolama Hesabı açılır. &#160; Ardından bu hesaba bağlanabilmek için ConnectionString bilgisini alıyoruz. &#160;]]></description>
								<content:encoded><![CDATA[<p>Öncelikle Azure’da Depolama Hesabı açılır.</p>
<p><img class=" wp-image-578 aligncenter" src="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_i1chOSC3jspWO4KdJWuAlQ-300x178.png" alt="" width="683" height="405" srcset="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_i1chOSC3jspWO4KdJWuAlQ-300x178.png 300w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_i1chOSC3jspWO4KdJWuAlQ-768x456.png 768w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_i1chOSC3jspWO4KdJWuAlQ-1024x608.png 1024w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_i1chOSC3jspWO4KdJWuAlQ-810x481.png 810w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_i1chOSC3jspWO4KdJWuAlQ-1140x677.png 1140w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_i1chOSC3jspWO4KdJWuAlQ.png 1500w" sizes="(max-width: 683px) 100vw, 683px" /></p>
<p>&nbsp;</p>
<div class="section-inner sectionLayout--insetColumn">
<p id="d018" class="graf graf--p graf-after--figure">Ardından bu hesaba bağlanabilmek için ConnectionString bilgisini alıyoruz.</p>
<p>&nbsp;</p>
</div>
<div class="section-inner sectionLayout--outsetColumn">
<figure id="29ca" class="graf graf--figure graf--layoutOutsetCenter graf-after--p" data-scroll="native">
<div class="aspectRatioPlaceholder is-locked"><img class=" wp-image-576 aligncenter" src="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_IstIf4CjUvOn1ToGG5_6iA-300x146.png" alt="" width="797" height="388" srcset="http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_IstIf4CjUvOn1ToGG5_6iA-300x146.png 300w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_IstIf4CjUvOn1ToGG5_6iA-768x373.png 768w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_IstIf4CjUvOn1ToGG5_6iA-1024x497.png 1024w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_IstIf4CjUvOn1ToGG5_6iA-810x393.png 810w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_IstIf4CjUvOn1ToGG5_6iA-1140x553.png 1140w, http://www.kemalburakyilmaz.com/wp-content/uploads/2019/03/1_IstIf4CjUvOn1ToGG5_6iA.png 1500w" sizes="(max-width: 797px) 100vw, 797px" /></div>
</figure>
</div>
<pre class="brush: csharp; title: ; notranslate">
    public void FileUpload(string fileName, HttpPostedFileBase file)
    {

        string strorageconn = &quot;Aldığımız ConnectionString bilgisi”;

        CloudStorageAccount storageacc = CloudStorageAccount.Parse(strorageconn);

        //Create Reference to Azure Blob

        CloudBlobClient blobClient = storageacc.CreateCloudBlobClient();

        //The next 2 lines create if not exists a container named &quot;democontainer”

        CloudBlobContainer container = blobClient.GetContainerReference(&quot;Container Adı”);

        container.CreateIfNotExists();

        //The next 2 lines upload the file test.txt with the name DemoBlob on the container &quot;democontainer”

        CloudBlockBlob blockBlob = container.GetBlockBlobReference(fileName);

        blockBlob.UploadFromStream(file.InputStream);

    }
</pre>
]]></content:encoded>
										</item>
	</channel>
</rss>
