Category Archives: Azure and Office 365
Deploying ASP.NET Web Applications to Azure Web Apps
Azure Web Apps is a service provided by Microsoft Azure to host .Net, Java, PHP, Node.js, Python applications. We can host Web, Mobile, API as well as Logic Apps using Azure Web App Service. In this article we will look at how we can deploy an ASP.NET application on the App Service. Pre-requisites Active Azure Subscription Visual Studio 2013 A. Deploy ASP.Net Web applications by signing into Visual Studio Open Visual Studio and create a new ASP.Net Application. Check Host in the Cloud in the Select Template Menu and click on OK. Sign in to your Azure Account. Select the Service Plan for your application. After the application has been successfully created you can publish it to Azure using the Publish button. B. Deploy an already created ASP.Net Web Application on Azure Login to your Azure account and then select Web Apps->New->Quick Create. Enter a valid url for your web app and then click on Create Web App. Next click on your web app and then click on download publish profile. After downloading the Publishing profile go back to Visual Studio to import this profile and start the deployment. Inside Visual Studio right click on the project and click on publish. Click on import and then select the publishing profile file that we had downloaded and then click on Ok. Click on Publish and the deployment will begin. If the deployment is successful you can browse you website from the app service using the url you had used to create the web app on Azure.
Share Story :
Setup custom domain and sub-domain name in Azure/GoDaddy Part -1
In this Blog we will walk-through how to add custom Domain/sub-domain in Azure web app with the help of GoDaddy. Problem Statement: We have a domain cloudfronts.in, purchased from GoDaddy and we want that it should point to website hosted on Azure. We have divided this blog in two different parts. Part 1: Add new custom Domain Part 2: Add new custom Sub-Domain Pre-Requisite: Azure Subscription with Web apps (Service administrator/Co-administrator) GoDaddy Account with new Domain (Admin) Next we need to follow the steps given below Steps 1: Login to your GoDaddy account with admin credentials and click on Manage domains. Steps 2: Click on domain name that you want to configure. In Our case we want to configure for cloudfronts.in. Double click on domain name and wait for new window. Step 3: Click on DNS Zone file and then edit option. Steps 4: We need some additional information from Azure web apps, that we will add in DNS configuration. Login to your Azure account and navigate to web site that you want to configure. Web site must be in share mode or standard mode to configure domain name. Change apps service plan pricing ties accordingly. Please refer following URL for more information http://azure.microsoft.com/en-in/pricing/details/app-service/ Navigate to Dashboard and click on Manage domains to add new custom domain name for your web site. Steps 5: Copy IP address of Azure web site. This information will need, when we add DNS record in GoDaddy. Steps 6: Add new A(Address) record and point to IP Address with below configuration. Record Type: A (Host) Host: @ Point to: 192.198.15.14 (Azure website IP Address) If @ record in already present, then edit that record. Add new CName record with below configuration. Record Type: CNAME (Alias) Host: www Point to: cloudfrontsdev.azurewebsites.net (Domain Name of Azure website) Kindly edit this record if already present. Steps 7: Add CNAME(Alias) record that will point to Azure website. This information is required by azure for verification purpose. Add two CNAME(Alias) record given in Image. Record Type: CNAME(Alias) Alias Name: awverify.www Points to Host Name: awverify.cloudfrontsdev.azurewebsites.net Record Type: CNAME(Alias) Alias Name: awverify Points to Host Name: awverify.cloudfrontsdev.azurewebsites.net Steps 8: Save all changes by clicking on Save Zone File. It might take 10-15 mins to update DNS entry. Steps 9: Add domain name in manage domain section(Azure) and click on ok. Reference https://azure.microsoft.com/en-in/documentation/articles/web-sites-custom-domain-name/
Share Story :
Setting up a static IP address to Virtual Machine in Microsoft Azure – Part 1
The blog post will show you how we can assign a static IP address to one of the Microsoft Azure Virtual Machines, using Microsoft Azure Powershell. Assumptions: Create Virtual Machine and Virtual Network in Microsoft Azure. Steps in Microsoft Azure Steps: Create a Virtual Machine named test and Virtual Network testing as shown below, where Internal IP Address of test is 10.0.0.5 Subnet-1 usable address rangeof 10.0.0.4 – 10.31.255.254 . The new static IP Address to be provided should fall in the usable range of address space. Steps in Microsoft Azure Powershell Step 1: Run Microsoft Azure Powershell as Administration. Step 2: Add your Microsoft Azure Account using the command Add-AzureAccount in Powershell. As shown in figure above it will ask the account details, I have selected my work account. Note: If at all this login control redirects to your personal account while doing in Work account, type Remove-AzureAccount in Powershell and enter and confirm the details. Once the account is added you can see that your account is added with the subscriptions present in your account. By the commands like Get-AzureVM you can see all the VM’s that are present in your account. Since I want to set a static IP Address to my test VM which is present in the testing virtual network with Internal IP Address of 10.0.0.5, I will get that VM in Powershell by the command Get-AzureVM –ServiceName sampleax –Name test, by this command we can view all the details associated with that particular VM with corresponding service name and VM name. All these details are shown in the diagram below. Step 3: Set IP Address to Test VM Here by the command Get-AzureVM –ServiceName sampleax –Name test | AzureStaticVNetIP –IPAddress 10.0.0.6 | Update-AzureVM As shown in figure above you can see the Succeeded message, this tells us that the corresponding IP is been set to the IP Address Provided in the command, here as 10.0.0.6. Step 4: To check the changed IP Address Now to see whether the IP Address is been set type the command Get-AzureVM –ServiceName sampleax – Name test This command will show the details with related VM as shown below. In the highlighted box we can see the IP is been set. We can also check the updated IP Address in Microsoft Azure as shown below that Internal IP is been now updated.
Share Story :
Add Office 365 Azure Directory into Windows Azure Part 1
In this blog we walk-through adding office 365 AD in your Windows Azure account. Blog is divided in two different parts. Part 1: Add Office 365 Active Directory into Microsoft account. Part 2: Add Office 365 Active Directory into Organization account. Pre-Requisite: Azure Subscription to the Microsoft account (Service Administrator). Global admin user of Office 365. Next we need to follow the steps given below to add Office 365 Active directory. Login to azure account using Microsoft account. Navigate to Active Directory and click on new button. Select “use existing directory” option because we are adding office 365 Active directory. Now sign-in with your office 365 user (Global admin). Above process is little bit tedious because user need to sign-in and sign-out frequently. Limitation: If Microsoft user email address and office 365 user email address is same then this process will get failed. Now you can see “A1 Tech solution” directory added to our Azure account. Add Azure subscription to Active directory. Select your AD from dropdown. Now you can see URL will be changed according to your Office 365 AD domain. Add co-administrator to your subscription. Note: Each subscription can be associate with only one Active directory. In order to add co-administrator we have to associate azure subscription with Active directory.
Share Story :
Auto Start-Stop Azure VM using Azure Automation
Problem Statement We a have requirement, where we want to start Azure VM every morning 8.30am and stop VM at 6.30pm excluding Saturday and Sunday. Pre-Requisite Azure subscription Virtual Machine Azure Automation Installation Activate Azure Automation Activate Azure automation from preview portal. Navigate to following URL to activate Automation. https://account.windowsazure.com/PreviewFeatures Add Automation account Select automation and click on Create Provide proper account name and region Connect to VM using automation Using Certificate Using Organization ID Part 1: Using Certificate Certificate Installation Open Windows run and type following command (inetmgr) Double click on Server certificate Create self-sign certificate (Top-Right corner) Provide useful name on select type personal. Now we required .cer and .pfx file for azure automation. Save .pfx file: Select path and type password. Password is required for uploading certificate on Azure. Save .cer file: Right click on AzureAutomation and click on view. Click on copy to file button. Upload certificate on Azure Upload .cer file Select .cer certificate from local machine. Upload .pfx file Navigate to Automation :- AutomationDemo(Account name) :- Assets Click on Add setting Click on Credential and provide credential name. This name we will used in Automation workflow as certificate name. Define connection for Automation Workflow Parameter: Automation certificate name will be same as Certificate name. Refer below image. For Subscription ID refer below image. Now we have completed with installation. Next part is to create wokflow. Add workflow for automation Create runbook under AutomationDemo account. We are creating runbook for auto start/stop VM. I have created runbook as StartVM under AutomationDemo account. After runbook is created, navigate to StartVM runbook. Kindly find sample code below workflow StartVM { param() #connection $MyConnection = “automationconnection” $MyCert = “automationcredential” # Get the Azure Automation Connection $Con = Get-AutomationConnection -Name $MyConnection if ($Con -eq $null) { Write-Output “Connection entered: $MyConnection does not exist in the automation service. Please create one `n” } else { $SubscriptionID = $Con.SubscriptionID $ManagementCertificate = $Con.AutomationCertificateName } # Get Certificate & print out its properties $Cert = Get-AutomationCertificate -Name $MyCert if ($Cert -eq $null) { Write-Output “Certificate entered: $MyCert does not exist in the automation service. Please create one `n” } else { $Thumbprint = $Cert.Thumbprint } #Set and Select the Azure Subscription Set-AzureSubscription ` -SubscriptionName “My Azure Subscription” ` -Certificate $Cert ` -SubscriptionId $SubscriptionID ` #Select Azure Subscription Select-AzureSubscription ` -SubscriptionName “My Azure Subscription” Write-Output “————————————————————————-” Write-Output “Starting the VM..” # Please type the name of your Domain Controllers inlinescript{ # function to get local time (example Convert UTC tome to Indian Time Zone) Function Get-LocalTime($UTCTime) { $strCurrentTimeZone = ‘India Standard Time’ $TZ = [System.TimeZoneInfo]::FindSystemTimeZoneById($strCurrentTimeZone) $LocalTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($UTCTime, $TZ) Return $LocalTime } #convert date time to UTC time Zone $date = (Get-Date).ToUniversalTime() # call function to get local time $locatTime= Get-LocalTime($date) #get day of week eg. Friday $locatTimeDayOfWeek= ($locatTime).DayOfWeek #get current day of the date eg. if current date is 21 November 2014 09:55:18 then day will be 21 $localTimeDay= ($locatTime).Day #$locatTimeDayOfWeek #$localTimeDay #do not start VM on saturday and Sunday if($locatTimeDayOfWeek -ne “Saturday” -and $locatTimeDayOfWeek -ne “Sunday”) { #$sample = Get-AzureWinRMUri -ServiceName $Using:CloudServiceName -Name $Using:VMName $StartOutPut = Start-AzureVM -ServiceName “democf” -Name “democf” Write-Output $”Virtual Machine democf started.” Write-Output $StartOutPut } elseif($localTimeDay -le 7 -and $locatTimeDayOfWeek -eq “Saturday”) { $StartOutPut = Start-AzureVM -ServiceName “democf” -Name “democf” Write-Output $”Virtual Machine democf started.” Write-Output $StartOutPut } else{ Write-Output “Virtual Machine is not started, because today is not a working day.” } } } Changes in above code Replace VM name with your VM name. Example : Start-AzureVM -ServiceName “democf” -Name “democf” ServiceName : Cloud Service name where vm is located -Name : is actual VM name In our case cloud service name and vm name is same, it can be deferent for other cases. After above changes is completed click on save and test. Check whether code is running perfectly or not. VM will not be start if it is Saturday or Sunday (Requirement). Now we will automate this workflow using schedule Now this workflow will be run every day at 8.30am to auto start VM. Same code auto stop vm using workflow, with small changes. workflow StopVM { param() #connection $MyConnection = “automationconnection” $MyCert = “automationcredential” # Get the Azure Automation Connection $Con = Get-AutomationConnection -Name $MyConnection if ($Con -eq $null) { Write-Output “Connection entered: $MyConnection does not exist in the automation service. Please create one `n” } else { $SubscriptionID = $Con.SubscriptionID $ManagementCertificate = $Con.AutomationCertificateName } # Get Certificate & print out its properties $Cert = Get-AutomationCertificate -Name $MyCert if ($Cert -eq $null) { Write-Output “Certificate entered: $MyCert does not exist in the automation service. Please create one `n” } else { $Thumbprint = $Cert.Thumbprint } #Set and Select the Azure Subscription Set-AzureSubscription ` -SubscriptionName “My Azure Subscription” ` -Certificate $Cert ` -SubscriptionId $SubscriptionID ` #Select Azure Subscription Select-AzureSubscription ` -SubscriptionName “My Azure Subscription” Write-Output “————————————————————————-” Write-Output “Stoping the VM..” # Please type the name of your Domain Controllers inlinescript{ # function to get local time (example Convert UTC tome to Indian Time Zone) Function Get-LocalTime($UTCTime) { $strCurrentTimeZone = ‘India Standard Time’ $TZ = [System.TimeZoneInfo]::FindSystemTimeZoneById($strCurrentTimeZone) $LocalTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($UTCTime, $TZ) Return $LocalTime } #convert date time to UTC time Zone $date = (Get-Date).ToUniversalTime() # call function to get local time $locatTime= Get-LocalTime($date) #get day of week eg. Friday $locatTimeDayOfWeek= ($locatTime).DayOfWeek #get current day of the date eg. if current date is 21 November 2014 09:55:18 then day will be 21 $localTimeDay= ($locatTime).Day #$locatTimeDayOfWeek #$localTimeDay #do not start VM on saturday and Sunday if($locatTimeDayOfWeek -ne “Saturday” -and $locatTimeDayOfWeek -ne “Sunday”) { #$StopOutPut = Start-AzureVM -ServiceName “mkadamvm” -Name $Using:test #$sample = Get-AzureWinRMUri -ServiceName $Using:CloudServiceName -Name $Using:VMName $StopOutPut = Stop-AzureVM -ServiceName “democf” -Name “democf” -Force Write-Output $”Virtual Machine democf Stopped.” Write-Output $StopOutPut } elseif($localTimeDay -le 7 -and $locatTimeDayOfWeek -eq “Saturday”) { $StopOutPut = Stop-AzureVM -ServiceName “democf” -Name “democf” -Force Write-Output $”Virtual Machine democf Stopped.” Write-Output $StartOutPut } else{ Write-Output “Virtual Machine is not started, because today is not a working day.” } } } References 1. http://clemmblog.azurewebsites.net/using-azure-automation-start-und-stop-virtual-machines-schedule/ 2. http://blogs.technet.com/b/keithmayer/archive/2014/04/04/step-by-step-getting-started-with-windows-azure-automation.aspx
Share Story :
UCC SAN SSL Certificate–GoDaddy/Azure
Introduction Adding sub-domain to UCC SSL 5 certificate and revoking existing SSL Certificate. Problem Statement: We have sub-domain called salesportal.mywebsite.com hosted on windows azure. Salesportal.mywebsite.com associated with SSL binding but that SSL is expired and we want to revoke that certificate and add it to UCC SSL 5 certificate from Go-daddy. => We have salesportal.mywesite.com hosted on windows azure. => SSL certificate purchase from Go-Daddy. In our case we want to remove standard certificate and add it to UCC 5 Certificate. Please follow below steps to revoke existing SSL and add it to New SSL certificate Installation To proceeds with SSL, first step is to download Open SSL. This is Open source software that will help us to create CSR request. Download Open SSL from following link: http://indy.fulgan.com/SSL/ Generate CSR Create CNF file for CSR For more detail visit following URL. http://azure.microsoft.com/en-in/documentation/articles/web-sites-configure-ssl-certificate/ Let’s understand how to apply SSL Certificate to multiple Domain. Download Sample code from http://azure.microsoft.com/en-in/documentation/articles/web-sites-configure-ssl-certificate/#bkmk_subjectaltname Example: # ————– BEGIN custom sancert.cnf —– HOME = . oid_section = new_oids [ new_oids ] [ req ] default_days = 730 distinguished_name = req_distinguished_name encrypt_key = no string_mask = nombstr req_extensions = v3_req # Extensions to add to certificate request [ req_distinguished_name ] countryName = Country Name (2 letter code) countryName_default = stateOrProvinceName = State or Province Name (full name) stateOrProvinceName_default = localityName = Locality Name (eg, city) localityName_default = organizationalUnitName = Organizational Unit Name (eg, section) organizationalUnitName_default = organization = Organization Name organization__default= commonName = Your common name (eg, domain name) commonName_default = www.mydomain.com commonName_max = 64 [ v3_req ] subjectAltName=DNS:payments. mydomain.com, DNS:blog.mydomain.com # ————– END custom sancert.cnf —– Note: => subjectAltName contains sub domain name. It can also contains main domain name as well. Example. www.crmonline.com File start with # ————– BEGIN custom sancert.cnf —– Above example can be tricky Problem statement 1: We have UCC SSL 5 certificate connected to payments.mywebsite.com and its running. We are adding salesportal.mywebsite.com domain to UCC SSL 5 certificate. In that case your Common Name will be payments.mywebsite.com and subjectAltName will be salesportal.mywebsite.com. Note: common name need to add from console window and subjectAltName in the cnf file. Example: # ————– BEGIN custom sancert.cnf —– HOME = . oid_section = new_oids [ new_oids ] [ req ] default_days = 730 distinguished_name = req_distinguished_name encrypt_key = no string_mask = nombstr req_extensions = v3_req # Extensions to add to certificate request [ req_distinguished_name ] countryName = Country Name (2 letter code) countryName_default = stateOrProvinceName = State or Province Name (full name) stateOrProvinceName_default = localityName = Locality Name (eg, city) localityName_default = organizationalUnitName = Organizational Unit Name (eg, section) organizationalUnitName_default = organization = Organization Name organization__default= commonName = Your common name (eg, domain name) commonName_default = www.mydomain.com commonName_max = 64 [ v3_req ] subjectAltName=DNS:salesportal.mywebsite.com, # ————– END custom sancert.cnf —– Problem Statement 2: We have UCC SSL 5 certificate connected to www.mywebsite.com and its running. We are adding salesportal.mywebsite.com domain to UCC SSL 5 certificate. In that case your Common Name will be www.mywebsite.com and subjectAltName will be salesportal.mywebsite.com. Please note: your common name you have to add from console window and subjectAltName in the cnf file. Example: # ————– BEGIN custom sancert.cnf —– HOME = . oid_section = new_oids [ new_oids ] [ req ] default_days = 730 distinguished_name = req_distinguished_name encrypt_key = no string_mask = nombstr req_extensions = v3_req # Extensions to add to certificate request [ req_distinguished_name ] countryName = Country Name (2 letter code) countryName_default = stateOrProvinceName = State or Province Name (full name) stateOrProvinceName_default = localityName = Locality Name (eg, city) localityName_default = organizationalUnitName = Organizational Unit Name (eg, section) organizationalUnitName_default = organization = Organization Name organization__default= commonName = Your common name (eg, domain name) commonName_default = www.mydomain.com commonName_max = 64 [ v3_req ] subjectAltName=DNS:salesportal.mywebsite.com, # ————– END custom sancert.cnf —– CSR Generation Write following command in Open SSL Console window. req -new -nodes -keyout myserver.key -out server.csr -newkey rsa:2048 -config sancert.cnf Note: sancert.cnf is above sample. myserver.key file is used to generate .pfx file. Steps 1: => Please fill basic information like Country name, State etc. => I have entered common name like payments.mywebsite.com because first time UCC SSL certificate is associate with payments.mywebsite.com. => If you are first time creating csr request then common name will be www.mywebsite.com If you want to check your CSR request then open CSR file in notepad and copy all code paste in following website. https://www.sslshopper.com/csr-decoder.html Revoke Expired SSL Certificate (GoDaddy) Always it’s better to revoke SSL certificate after it is expired. Please refer following URL for more support. https://support.godaddy.com/help/article/4747/revoking-an-ssl-certificate?countrysite=in Login to GoDaddy account: 1. Click on SSL Certificate: 2. Click on manage You can see we have one sub-domain Standard SSL is expired and another sub-domain has standard UCC SSL 5 certificate. We are going to add expired sub domain to standard UCC SSL certificate. 3. Click view status of expired domain. 4. Click on conform after that following window will appeared. 5. Wait for few minutes and refresh page. Certificate is expired successfully. 6. Following is status of certificate Add Domain to UCC 5 Certificate Click on domain which has UCC 5 certificate. If you have just purchase UUC 5 certificate then open that certificate and paste csr request. (Which also include # ————– BEGIN custom sancert.cnf —–# and # ————– END custom sancert.cnf —–#). Then click on manage. To add domain to UCC 5 Certificate, first we need re key that certificate Copy and paste your CSR in a text box Then Click on submit changes that will submit your New CSR request to GoDaddy Verification window will appeared. Refresh this page, you can see new Domain is successfully added to this certificate. Install certificate to Azure Download certificate from GoDaddy => Select Server type IIS and download zip file. => Important file is .crt extension and Ignore other files contain in zip => Open OpenSSl and click run as administrator(Run as administrator is IMP) Type following command in command line pkcs12 -export -out salesportal.pfx -inkey myserver.key -in 889d0fa6641ee566.crt myserver.key is … Continue reading UCC SAN SSL Certificate–GoDaddy/Azure