Select-AzureRmProfile : The term ‘Select-AzureRmProfile’ is not recognized as the name of a cmdlet, function, script file, or operable program

I got a chance to work with PowerShell automation script to automate the login process. In the script, the profile is loaded using the Select-AzureRmProfile. If you try to log in using Select-AzureRmProfile you most likely encounter the following error message.

Error Message:

Select-AzureRmProfile : The term ‘Select-AzureRmProfile’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:36 char:1

+ Select-AzureRmProfile -Path c:\AzureDataLakeprofile.json

+ ~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (Select-AzureRmProfile:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

Select-rmAzureDL

Workaround:

The Select-AzureRmProfile is no-more a validate cmdlet. If you encounter Select-AzureRmProfile cmdlet in the script, you may need to replace with Save-AzureRmContext and Import-AzureRmContext.

PS:\>Save-AzureRmContext -Path c:\AzureDataLakeprofile.json

PS:\>Import-AzureRmContext -Path c:\AzureDataLakeprofile.json

Output:

Now, you can see that the profile got loaded successfully

Azureaccount

Advertisements
| Tagged , | Leave a comment

Top 50 PowerShell bloggers of 2018

My work is recognized and my blog is listed under Top 30 elite list.

I am pleased, honored and humbled to accept this award and to join other great recipients who I have long admired and respected.  A very special thanks to the SQLShack family for their effort in identifying and publishing the Top blogs of 2018. And, of course, thank you to my family, readers, friends, supporters, and mentors for always supporting me.

Top 50 PowerShell bloggers of 2018

ranking

Thank you SQLShack and the team for the great recognition.

 

 

 

Posted in awards | Tagged | Leave a comment

How to automatically Discover SQL Server instances

DBAs have plenty of day-to-day tasks to do as part of the administration, but one overarching task is managing the entire SQL Server environment. To do this, the full SQL Server estate must be discovered and inventoried. To accomplish that all SQL Server instances, that exist, must be found.

Inventory

A system inventory is always the go-to document for vital information for everyone whether you’re a consultant or an in-house DBA; you must have a reliable inventory of the servers that you manage. The inventory can be defined in different ways since it takes many different dimensions but at its core, it’s an aggregation of information about the system installation topography. However, often, we tend to forget to update the inventory when we add a server or update software. We deploy new servers, decommission existing servers, keeping track of servers in the environment, upgrade process, patching, migration from physical to virtual machines, moving to the cloud, license validation, IT forecasting and many more such areas strongly rely on the inventory list.

Further reading

Auto-discover SQL Server instances

 

 

Posted in SQL | Tagged , , , , | Leave a comment

SQL Date functions in SQL Server

SQL date format functions like the DateDiff SQL function and DateAdd SQL Function are oft used by DBAs but many of us never took the time to fully understand these extremely useful features. For professionals just getting started with SQL Server, these functions are some of the first to become familiar with. So hopefully this article will have a little something for everyone across the skill spectrum

One of the most interesting data types that are supported in the relational database world is DateTime. In this article, we’re going to take a look at working with date time data types in SQL Server. We’ll understand the basics of date-time data-type and also, we’ll see various examples of how to query the date-time fields using built-in functions within SQL Server for manipulating the data, transforming date-time values and in few cases, perform arithmetic operations.

Further reading…

SQL Date functions

 

Posted in SQL | Tagged , | Leave a comment

Overview of DML Operations – SQL Delete

This article on the SQL Delete is a part of the SQL essential series on key statements, functions and operations in SQL Server.

To remove a row from a table is accomplished through a Data Manipulation Language, aka DML statement, using the delete keyword. The SQL delete operation is by far the simplest of all the DML commands. On execution of the delete command, we don’t have to worry about getting any form of data from the table, and we don’t have to worry about working with any data that we get back from the table(s). We just simply tell the database to delete a specific record, and it either does or it doesn’t. It’s that simple.

First, let’s quickly review what an SQL delete statement looks like.  We need to tell the database and table from where it should delete the data. It’s a good idea to add a condition clause to set the scope of data deletion. Otherwise, it will delete everything on the table.

Further reading

SQL Delete 

 

 

 

 

Posted in SQL | Tagged | Leave a comment

Overview of the SQL Insert statement

This article on the SQL Insert statement is part of a series on string manipulation functions, operators and techniques. The previous articles are focused on SQL query techniques, all centered around the task of data preparation and data transformation.

The general format is the INSERT INTO SQL statement followed by a table name, then the list of columns, and then the values that you want to use the SQL insert statement to add data into those columns. Inserting is usually a straightforward task. It begins with the simple statement of inserting a single row. Many times, however, it is more efficient to use a set-based approach to create new rows. In the latter part of the article, let’s discuss various techniques for inserting many rows at a time.

Pre-requisite

The assumption is that you have the following the permission to perform the insert operation on a table

  • Insert operation defaults to the members of the sysadmin fixed server role, the db_owner and db_datawriter fixed database roles, and the table owner.
  • Insert with the OPENROWSET BULK option requires a user to be a member of the sysadmin fixed server role or of the bulkadmin fixed server role.
  • Download AdventureWorks2014 here

 

further reading…

https://www.sqlshack.com/overview-of-the-sql-insert-statement/

 

 

Posted in SQL | Tagged , , | Leave a comment

SQL Pivot and Unpivot relational operatots

In this article, we’ll walk-through the SQL Pivot and SQL Unpivot operators and how they can be useful to transpose SQL Server data. Also, we’ll discuss both static and dynamic ways to use PIVOT and UNPIVOT relational operators that can be used to transform aggregated distinct values as column(s) in the result-set by specifying all the column values in the PIVOT IN clause.

SQL Server pivot Introduction

There are several ways to transpose a dataset from rows to columns and columns to rows. SQL Pivot is one of the techniques that allows transposing of rows to columns and performs possible aggregations along the way. SQL PIVOT and SQL UNPIVOT relational operators transpose a table-valued two-dimensional data into another form of data. SQL PIVOT transposes a table-valued expression from a unique set of values from one column into multiple columns in the output and performs aggregations. SQL UNPIVOT performs the opposite operation of SQL PIVOT by transforming the columns of a table-valued expression into column values.

 

Continue reading…

SQL Pivot and Unpivot

 

 

 

Posted in SQL | Tagged , , | Leave a comment

Overview of the SQL Update statement

In this article, we’ll walk-through the SQL update statement to modify one or more existing rows in the table. 

 

After reading this article, you’ll understand the following topics covering how to use a simple SQL update statement

  1. on multiple columns
  2. with computed value
  3. with the compound operator
  4. with the defaults
  5. with SQL joins
  6. with the Where clause
  7. on a remote table
  8. with use Top(n) clause
  9. with CTE (Common-Table-Expression) statements

Further Reading…

 

SQL Update

 

Posted in SQL | Tagged , , , , | Leave a comment

Overview of SQL UNION

This article will provide a deep dive into the SQL UNION operator, describing its many uses along with examples and explore some common questions like the differences between UNION vs UNION ALL.
To address real-world data requirements, we may need to combine result sets from multiple data sources so that we could do data analysis or create new datasets. The datasets may be identical but there are chances that they reference different tables. Is there a way to combine the data in a single query? Are Set Operators a viable option? Let’s get started and see how some of the existing operators can be used to help us address these common challenges.

In this article, we’ll review:

  1. What a Set operator is
  2. UNION vs UNION all and how they work
  3. Discuss the rules for using UNION vs UNION ALL
  4. SQL Operator Syntax
  5. How to use simple SQL UNION clause in the select statement
  6. How to use SQL UNION with the queries that have the WHERE clause
  7. How to use the SELECT INTO clause with UNION
  8. How to use SQL UNION with the queries that have a WHERE clause and order by clause
  9. How to use SQL UNION and SQL Pivot
  10. How to use SQL UNION with GROUP and HAVING clauses

 

Continue reading…

SQL Union 

 

Posted in T-SQL | Tagged , , , | Leave a comment