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

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

主站蜘蛛池模板: 波密县| 龙井市| 抚顺市| 大悟县| 类乌齐县| 进贤县| 花莲县| 双桥区| 改则县| 涿鹿县| 城市| 左权县| 方城县| 云林县| 色达县| 兴安县| 会东县| 扶余县| 鄂伦春自治旗| 九台市| 宁武县| 牙克石市| 织金县| 汉源县| 邹平县| 通榆县| 乌审旗| 古田县| 小金县| 偃师市| 苏尼特右旗| 赤壁市| 南雄市| 睢宁县| 平安县| 平乐县| 清苑县| 平江县| 昭通市| 阳原县| 河北区|