Friday, October 13, 2023

Using LocalDB in 3 Steps

Problem: While doing a demo on a client’s PC that didn’t have SQL Server Developer Edition installed, I needed a quick way to demonstrate querying a SQL Server DB without installing SQL Server.

 

Solution: LocalDB to the rescue!  The client’s PC did have SQL Server Management Studio installed, along with SQL Server Express.  This gave me enough capability to create a sample DB and demonstrate how to query it.

 

To create a DB instance:

  1. Open a Command Prompt window
  2. Enter “sqllocaldb create “Ch1Demo” “, where Ch1Demo was the specific name of my DB instance.  This short command quickly created an instance using the default version of the SQL Server DB Engine installed (see below).  This process was nearly instant (see below).

 

 

Since my username is “Sam”, The DB was created in the path C:\Users\Sam\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\Ch1Demo

 

  1. To connect to the DB instance, simply use SQL Server Management Studio with the Server Name preceded with “(localdb)\”

 

 

For all intents and purposes, Ch1Demo will appear as any other DB instance, allowing DB creation, updates, and queries.

 

 

This was the perfect solution in a pinch, and it helps you as well.

 

To learn more about localDB, visit https://learn.microsoft.com/en-us/sql/tools/sqllocaldb-utility?view=sql-server-ver16

 

Wednesday, October 11, 2023

Oct '23 Regional Tech Events

ChatGPT for Business

Recently David Giard (Microsoft) delivered a presentation on using ChatGPT.  Aside from answering basic questions, he demonstrated some key business and professional cases:

  • Create a LinkedIn Profile
  • Write a Professional email
  • “How do I increase my followers on Twitter?”
  • “How do I increase customer base?”
  • “How to organize a conference or event?”
  • Get ideas for writing, to prevent writers block

 

The full presentation can be seen at https://www.youtube.com/watch?v=noXxynTEEhg

 

 

 

 

 

 

 

Wednesday, May 10, 2023

Microsoft Azure Fundamentals Q&A

While attending a Microsoft Azure Fundamentals Training session today, some interesting questions were posted.  Listed below is the Q&A from the forum:

 

1.      How does private cloud differ from on-prem?

A private cloud may be hosted from your onsite datacenter, which would be on-premises. It may also be hosted in a dedicated datacenter offsite, potentially even by a third party that has dedicated that datacenter to your company. You can find more information here: https://learn.microsoft.com/en-us/training/modules/describe-cloud-compute/5-define-cloud-models

 

2.      Which is cheaper, public or hybrid cloud?

This depends on how your organization is structured, the size, and the services you need. You can compare on-premises and cloud costs using the Total Cost of Ownership Calculator here: https://azure.microsoft.com/en-us/pricing/tco/

 

3.      When to use private cloud (on prem) without [public] cloud ?

In some cases, your organization may be legally required to store information in your own data center. There may be other compliance and cost considerations as well. The size of your company and the resources you need may be less expensive in one form or another. You can find more information here: https://learn.microsoft.com/en-us/training/modules/describe-cloud-compute/5-define-cloud-models

 

4.      Does Hybrid cloud incurs both capital and operational expenditure?

Yes, hybrid cloud incurs both capital and operational expenditure.

 

5.      Is there any difference in availability of private and public cloud ?

There may be a difference in availability depending on the circumstances. If you have older technology in your private cloud, you may have more latency. Or, if you have resources on the other side of the globe in the public cloud, you may also have latency. There are many variables.

 

6.      What’s the definition for public cloud?

A public cloud is built, controlled, and maintained by a third-party cloud provider. You can find more information here: https://learn.microsoft.com/en-us/training/modules/describe-cloud-compute/5-define-cloud-models

 

7.      Does "Private Cloud" mean some form on on-prem Azure or AWS, etc.?

Azure and AWS are examples of Public Cloud. This is the opposite of private cloud. with Private cloud, you are owning/operating your own resources. With public cloud, your provider owns and operates the hardware. You can find more information here: https://learn.microsoft.com/en-us/training/modules/describe-cloud-compute/5-define-cloud-models

 

8.      Would you explain the difference between elasticity and scalability?

Scalability means increasing or decreasing services as needed. Elasticity refers to enabling the increase or decrease of automatically: When a resource meets a limit, it will automatically increase as needed.

 

9.      If I create a VM in Cloud, will I be charged even if VM is shut down?

Yes, because your VM is still taking up storage space. You will not be charged for run time if it is not running, though.

 

10.   Does Azure provide private cloud capabilities if customer demands?

Yes, there are some options for organizations to have dedicated hardware. One example is with Azure dedicated host. More information about that is available here: https://learn.microsoft.com/en-us/azure/virtual-machines/dedicated-hosts  

 

11.   Please provide definition for CAPEX

CapEx refers to Capital Expenditure and is typically a one-time, up-front expenditure to purchase or secure tangible resources. A new building, repaving the parking lot, building a datacenter, or buying a company vehicle are examples of CapEx. You can find more information here: learn.microsoft.com/en-us/training/modules/describe-cloud-compute/6-describe-consumption-based-model

 

12.   Do Microsoft Azure has a data center in the continent of Antarctica?

Great question. I don't see one in Antarctica. You can find the list here: https://azure.microsoft.com/en-us/explore/global-infrastructure/geographies/#choose-your-region  

Friday, January 20, 2023

7 Ways to Reduce Azure Costs

Listed below are 7 ways to reduce your Azure monthly cost.


1. Shut down unused resources

Use Azure Advisor to identify idle virtual machines (VMs), ExpressRoute circuits, and other unused resources.


2. Right-size underused resources

Find resources not fully utilized with Azure Advisor.  It will also provide recommendations on reconfiguring resources to reduce cost.


3. Reserve instances for consistent workloads

Use reservation pricing to pre-pay for resources for a 1 or 3 year term.  This could result in a discount of up to 72% over pay-as-you-go pricing on Azure services.


4.
Take advantage of the Azure Hybrid Benefit

Have existing on-premises software licenses?  Use them with Azure for no additional cost and select Azure services for free.


5. Configure autoscaling

Avoid the high cost of hardware investment used only during peak times of the year.  Instead, dynamically allocate and de-allocate resources to match your business needs when you need it.


6. Set up budgets and allocate costs to teams and projects

Use Microsoft Cost Management to create and manage budgets of Azure services used, and monitor your organization’s cloud spending.


7. Choose the right Azure compute service

Azure offers a variety of resources, with varying degrees of management.  Depending on the level of resource management you choose, the monthly spend can be reduced significantly. Use the following diagrams to identify the various resources and management needs.

 

 

Diagram Reference: https://medium.com/chenjd-xyz/azure-fundamental-iaas-paas-saas-973e0c406de7

 

 

 

 

 

 

Wednesday, December 14, 2022

Text-to-Speech Step-By-Step

Overview

Speech services is one of the main categories of Azure Cognitive Services.  Using this service, developers can utilize one of the four API’s to perform the following:

  1. Speech-to-Text
  2. Text-to-Speech
  3. Text Translation
  4. Speaker Recognition

 

In a previous post, I wrote a tutorial on converting Speech-to-Text.  For this post, I will go in the opposite direction and provide step-by-step directions to covert text-to-speech.

 

 

How to Use Text-to-Speech

  1. First, we need to setup the Speech resource in Azure.  Simply specify “speech services” in the search bar, and all speech resources in Azure marketplace will be displayed.  For this project, we will use Microsoft’s Speech Azure Service.

 

 

  1. After clicking create and providing the fundamental parameters for the setup, subscription keys will be provided.

 

 

 

  1. Obtain the subscription key for the above resource

 

 

 

  1. Setup a console project in Visual Studio, and add the “Microsoft.CognitiveServices.Speech” NuGet package.  Listed below is the complete code file.

 

 

The class “Program” contains 2 methods: Main() & CheckResult(). 

 

Breaking Down Main()

Looking at Main(), the first task is to obtain the Subscription key and region.  These 2 values are obtained from Step 3 above, and are tied to the Azure subscription.  They can be used by anyone who obtains them.  For this reason, these items are stored in .Config file and not made available to the reader.

 

The next task is to instantiate SpeechConfig class using the subscription and region.  The purpose of this class to contain all configuration for the Speech Service.

In addition to subscription and region, line 14 specifies the voice to be used for the speech synthesis.  Azure Speech Service offers a variety of voices and supported languages, and can be found here.

 

After the speechConfig class is configured, it’s passed to the constructor of the SpeechSynthesizer class.  As the name suggests, this class contains methods for synthesizing, or converting, text to speech.  It utilizes all configuration settings specified in the prior steps.

 

In lines 17-26, an infinite while loop cycles through asking the user for text input, asynchronously calling the SpeakTextAsync() in the speechSynthesizer class. 

speechSynthesizer.SpeakTextAsync() is an async method that takes the text string as an input parameter, sends it to Azure Speech Services to be synthesized as the desired spoken language, then plays the synthesized speech on the default speaker.

 

 

Breaking Down CheckResult()

This method is used for error checking the synthesis results and handling it accordingly. CheckResult() examines the results returned in the Reason property of the speechSynthesisResult instance.  If synthesis completed successfully, it simply echoes the text entered.  Otherwise if an error occurred, it will display the messages stored in the ErrorCode and ErrorDetails properties of the SpeechSynthesisCancellationDetails class.

 

A complete demo of Text-to-Speech service can be found in this segment.

 

 

Why use Text-to-Speech

The first reaction most developers have once they hear the results is “how cool is this?”.  It’s certainly cool, but the benefits of this feature extend beyond a novelty. Applications can now verbally communicate results with visually impaired users, a segment of the user population that is often overlooked.  Another benefit of verbal communication is allowing all users to hear results while doing other tasks instead of having to focus on a screen to read results. Text-to-Speech is 1 of 4 services in the Speech category of Cognitive Services. 

 

A video presentation and demo on “Overview of Speech Services” discusses all the services in more detail.  The corresponding code used for the video presentation and this article can be found at https://github.com/SamNasr/AzureSpeechServices.

 

 

This post was featured as part of the C# Advent 2022, an annual blogging event hosted by Matthew D. Groves

Wednesday, December 7, 2022

VNet Questions Answered

During the last meeting of the .NET Study Group on Azure Virtual Networks, a couple questions came up that needed further explanation.  I thought it would be best to post the and share them

 

Question: Do I need a NSG or Subnet if a VM is in VNet? 

Answer: Yes, it’s a best practice.  By default, services outside the VNet cannot connect to services within the VNet.

However, you can configure the network to allow access to the external service.  Therefore, assume you have a VNet that contains both web servers and DB servers.  You can have VNET configured for public access to allow outside users to access the web servers.  You would also need a subnet or NSG to prevent that same public traffic from accessing the DB servers in the same VNet.

 

Question: Can you provide a sample diagram of the Azure Infrastructure and how VNets would be implemented?

Answer: See below for the Sample Azure Infrastructure Diagram: (https://www.dotnettricks.com/learn/azure/what-is-microsoft-azure-virtual-network-and-architecture)

 

 

 

Question: Where can I find a list of Frequently asked questions on Azure VNets?

Answer: For additional reading on Azure VNet, see the FAQ page at https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-faq