官术网_书友最值得收藏!

Deploy-AzureResourceGroup.ps1

In this PowerShell script, we are going to check to see if you are logged in. If you are not logged in, the script will run a validation on your script, create a storage area, upload files to the storage, assign a 4-hour access key, and then run the deployment. The majority of PowerShell is generated when you select an Azure Resource Manager in Visual Studio, but I did add the following login function to help ensure that I am logged in to the right tenant:

function Check-Login
{
$needLogin = $true
Try
{
$content = Get-AzureRmContext
if ($content)
{
$needLogin = ([string]::IsNullOrEmpty($content.Account))
}
}
Catch
{
if ($_ -like "*Login-AzureRmAccount to login*")
{
$needLogin = $true
}
else
{
throw
}
}
if ($needLogin)
{
Login-AzureRmAccount
}
}
Check-Login

主站蜘蛛池模板: 女性| 榆中县| 东台市| 保靖县| 饶河县| 洪江市| 格尔木市| 四平市| 安阳市| 佛冈县| 江陵县| 元江| 游戏| 湘西| 上栗县| 浦县| 海丰县| 洞口县| 嘉义市| 晴隆县| 读书| 沾益县| 桦甸市| 囊谦县| 泸州市| 兴山县| 崇礼县| 西贡区| 郸城县| 玛曲县| 扶沟县| 三原县| 囊谦县| 无为县| 沙河市| 云南省| 大荔县| 东方市| 介休市| 仪陇县| 翁牛特旗|