https://social.technet.microsoft.com/forums/azure/en-US/260df055-7c4e-4ce2-8f8d-190ad20a4b76/cant-get-azure-credentials-to-stick-in-powershell?forum=windowsazuresecurity

Hi all,

I am wanting to use Powershell (v4) to automate backup and restore of
SQL Azure DB to Azure Storage. I am using certificate method....download
publishsettings file for my subscription and import via PS console
command Import-AzurePublishSettingsFile. I have
verified that the cert is imported and registered on machine Get-Item
cert:\\CurrentUser\My\$thumbprint.  Script is failing with
"Get-AzureSqlDatabaseServer : Your Windows Azure credential in the
Windows PowerShell session has expired. Please use
Add-AzureAccount to login again." message.  If I authenticate in the
console using Add-AzureAccount it all starts working again. Then if I
close the session or let it time out and try to run it I get the
prompt/error again. This obviously does not
work for automating with scripts and I am in need of some help in
solving this issue. Any help appreciated.

Regards,

Frank Silano
Developer/Architect 
BBI

  • Moved by
    Bill_Stewart
    Thursday, April 24, 2014 8:11 PM
    Move to more appropriate forum
Thursday, April 24, 2014 8:03 PM

Reply

|

Quote

Avatar of Frank Silano
Bloomin Brands, Inc.
 

0 Points

 

Answers

I'd try this:

- Run REMOVE-AZUREACCOUNT first, before you start running your
scripts, make sure you get rid of that azure account from your PS
Session

Then run your script using the publish settings file and cert mgmt.
This should work. If you use Add-azureaccount it overwrites certificate
authorization. If you remove-azureaccount it will fall back to
certficiate authorization.

Let me know how it goes - Matt Sampson


R. Matt Sampson

Remove-Azureaccount (Can't get Azure credentials to stick in Powershel)的更多相关文章

  1. Credentials(Rails5.2新) 很基础的知识点,具体还要实操。

    Credentials(Rails5.2新) 增加config/credentials.yml.enc 憎加config/master.key 移除了5.1使用的config/secrets.yml, ...

  2. Azure Storage Blob Go SDK示例

    简介 前面一篇博客介绍了关于Azure ManagerAPI Go SDK的使用,本篇继续介绍使用Blob Go SDK 操作中国区Azure Blob. SDK下载: go get github.c ...

  3. 【Azure Developer】调用SDK的runPowerShellScript方法,在Azure VM中执行PowerShell脚本示例

    当需要通过代码的方式执行PowerShell脚本时,可以参考以下的示例. Azure SDK中提供了两个方法来执行PowerShell脚本 (SDK Source Code: https://gith ...

  4. 【Azure Developer】使用Java代码启动Azure VM(虚拟机)

    问题描述 在使用Java的启动Azure VM的过程中,遇见了com.azure.core.management.exception.ManagementException: Status code ...

  5. 【Azure Developer】使用Java SDK代码创建Azure VM (包含设置NSG,及添加数据磁盘SSD)

    在参考Azure官方文档进行VM创建时,发现其中没有包含如何设置NSG的内容,以及如何在创建时就添加数据磁盘的代码(设置磁盘为SSD类型).本文的内容以"使用 Java 创建和管理 Azur ...

  6. windows环境:idea或者eclipse指定用户名操作hadoop集群

    方法 在系统的环境变量或java JVM变量添加HADOOP_USER_NAME(具体值视情况而定). 比如:idea里面可以如下添加HADOOP_USER_NAME=hdfs 原理:直接看源码 /h ...

  7. Android窗口管理服务WindowManagerService对壁纸窗口(Wallpaper Window)的管理分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8550820 Android系统中,壁纸窗口和输 ...

  8. 【Azure Developer】【Python 】使用 azure.identity 和 azure.common.credentials 获取Azure AD的Access Token的两种方式

    问题描述 使用Python代码,展示如何从Azure AD 中获取目标资源的 Access Token. 如要了解如何从AAD中获取 client id,client secret,tenant id ...

  9. How to install and configure Azure PowerShell

    https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/ In this artic ...

随机推荐

  1. 立flag

    lixintong这半年来一直浪啊浪啊都不认真做题!!!!!!简直是太堕落啦!!lixintong非常讨厌这样的lixintong !!! 鉴于lixintong NOIP 完全爆炸啦! lixint ...

  2. 使用JS实现图片展示瀑布流效果

    不知大家有没有发现,一般的图片展示网站都会使用瀑布流效果,所谓的瀑布流 就是网站内的图片不会一下子全缓存出来,而是等你滚动到一定的距离的时候, 下面的图片才会继续缓存,并且图片也是随机出现的,只是宽度 ...

  3. Join函数 及Split函数精解示例

    '************************************************************************* '**模 块 名:Join函数 及Split函数精 ...

  4. HTML基础篇之列表相关标签和特殊字符实体

    HTML字符实体 常用的字符实体: 实体字符 字符实体 大于号 (>) > 小于号 (<) < 引号 (") " 注册商标(®) ® 版权(© ) © &a ...

  5. bzoj 4445 [SCOI2015] 小凸想跑步

    题目大意:一个凸包,随机一个点使得其与前两个点组成的面积比与其他相邻两个点组成的面积小的概率 根据题意列方程,最后求n条直线的交的面积与原凸包面积的比值 #include<bits/stdc++ ...

  6. 关于 apue.h 的使用方法

    unix中有很多地方使用到apue.h  .apue.h是作者自己写的一个头文件,这个文件怎么用,晚上有很多方法,但是经过尝试大多不好用. 经过本人尝试,可以把src.3e.tar.gz 的代码解压到 ...

  7. AI PRO I 第4章

    Behavior Selection Algorithms An Overview Michael Dawe, Steve Gargolinski, Luke Dicken, Troy Humphre ...

  8. django对数据查询结果进行排序的方法

    在你的 Django 应用中,你或许希望根据某字段的值对检索结果排序,比如说,按字母顺序. 那么,使用 order_by() 这个方法就可以搞定了. ? 1 2 >>> Publis ...

  9. 视觉机器学习读书笔记--------SVM方法

    SVM是一种二类分类模型,有监督的统计学习方法,能够最小化经验误差和最大化几何边缘,被称为最大间隔分类器,可用于分类和回归分析.支持向量机的学习策略就是间隔最大化,可形式化为一个求解凸二次规划的问题, ...

  10. Quartz2D 编程指南(二)变换、图案、阴影

    概览 图形上下文 路径 颜色与颜色空间 变换 图案 阴影 渐变 透明层 Quartz 2D 中的数据管理 位图与图像遮罩 CoreGraphics 绘制 Layer 5.变换 简介 Quartz 2D ...