azure-powershell

How do I properly use ForEach() statement of List?

拥有回忆 提交于 2019-12-01 09:21:24
问题 I'm confused what I'm doing wrong in ForEach method syntax of List? PS D:\ntt> $nicInfo.IpConfigurations.Count 2 PS D:\ntt> $nicInfo.IpConfigurations[0] PrivateIpAddressVersion Name Primary PrivateIpAddress PrivateIpAllocationMethod Subnet Name PublicIpAddress Name ProvisioningState ----------------------- ---- ------- ---------------- ------------------------- ----------- -------------------- ----------------- IPv4 ipconfig1 True 10.233.0.4 Dynamic Succeeded PS D:\ntt> $nicInfo

PowerShell script error: the string is missing the terminator:

房东的猫 提交于 2019-12-01 08:23:11
Incredibly simple powershell script... #Server side storage copy $SourceStorageAccount = "myStorageAccount" $SourceStorageKey = "myKey" $SourceStorageContext = New-AzureStorageContext –StorageAccountName $SourceStorageAccount -StorageAccountKey $SourceStorageKey fails with the error At E:\DeploymentScripts\Storage\Test.ps1:6 char:51 + ... geContext –StorageAccountName $SourceStorageAccount -StorageAccount ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The string is missing the terminator: ". + CategoryInfo : ParserError: (:) [], ParseException + FullyQualifiedErrorId :

Azure PowerShell: Enable Application Diagnostics and Site Diagnostics

假装没事ソ 提交于 2019-12-01 08:17:34
问题 I am configuring Diagnostics & IIS Logs for Azure Websites. Azure Manage Portal shows options to store Application Diagnostics to Azure Table Storage: And pops up a dialog on clicking 'manage table storage' to provide Azure Table details: Site Diagnostics to Blob Storage: I am searching for Azure Cmdlet to enable these using PowerShell at deployment time. Here is the Cmdlet i could find but it doesnt have any option to provide table details: Enable-AzureWebsiteApplicationDiagnostic C:\PS

How to run Azure CLI commands using python?

无人久伴 提交于 2019-12-01 06:44:35
I want to use Azure CLI to get the list of all the VMs in my resource group. But I want to implement the same using a python script. For example, I will use the following command in Azure CLI to list the VMs in my resource group: " az vm list -g MyResourceGroup " But, I want the python script to do the same, where I just have to incorporate the CLI command in the python program. How to run Azure CLI commands using python? According to this file . we could invoke the Azure CLI with following way: from azure.cli.core import get_default_cli get_default_cli().invoke(['vm', 'list', '-g', 'groupname

PowerShell script error: the string is missing the terminator:

戏子无情 提交于 2019-12-01 04:58:07
问题 Incredibly simple powershell script... #Server side storage copy $SourceStorageAccount = "myStorageAccount" $SourceStorageKey = "myKey" $SourceStorageContext = New-AzureStorageContext –StorageAccountName $SourceStorageAccount -StorageAccountKey $SourceStorageKey fails with the error At E:\DeploymentScripts\Storage\Test.ps1:6 char:51 + ... geContext –StorageAccountName $SourceStorageAccount -StorageAccount ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The string is missing

Azure Powershell - automating Login-AzureRmAccount AD Login - for Azure function

有些话、适合烂在心里 提交于 2019-12-01 03:01:12
问题 I have this Azure Powershell script, which successfully backs up a SQL Azure DB to Azure Blob. In its current form, it requires me to log in via AD. I now need to implement this script to execute via a Azure Function at specific intervals. The first snippet of the script: $subscriptionId = "YOUR AZURE SUBSCRIPTION ID" Login-AzureRmAccount Set-AzureRmContext -SubscriptionId $subscriptionId I thus need to not use Login-AzureRmAccount, but replace it with a method that does not require human

Add many domains to an azure web site

耗尽温柔 提交于 2019-12-01 01:20:22
问题 I'm migrating a pretty serious multi-tenant application to Azure, and one of the challenges I see coming is that it hosts over a hundred domains. On the Azure side, the only way I see to add a custom domain is hand-entering them via the portal. I would really like to script this out with Azure PowerShell or (perhaps less desirable for this one-off operation) one of the .Net APIs. I did find this, which shows that it can be done with one of the REST APIs: Add a domain to an Azure web site via

No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription

我与影子孤独终老i 提交于 2019-11-30 18:29:30
I’m keep getting the above error when trying to execute Start-AzureService. Following information prompted when executing Get-AzureAccount: Id Type Subscriptions Tenants -- ---- ------------- ------- Me@outlook.com User 12345678-1234-5678-9012-345678901235 {12345678-1234-5678-9012-345678901235} And following information prompted when executing Get-AzureSubscription: SubscriptionId : 12345678-1234-5678-9012-345678901235 SubscriptionName : My Production (Pay-As-You-Go) Environment : MyCloud DefaultAccount : Me@outlook.com IsDefault : True IsCurrent : True TenantId : 12345678-1234-5678-9012

Azure ARM Template Unit Test

二次信任 提交于 2019-11-30 14:21:04
How to test Azure ARM Templates and validate them whether these are written correctly or not from local VM. I have tried it from Power Shell but it just validate only. I want to Unit Test the ARM templates You can do unit test the ARM Templates with PESTER . If you are unfamiliar with pester, you can refer to this document . Example ARM Template The example template being tested allows for the selection of whether managed or un-managed disk are used for the VM. The template can be found here https://github.com/bentaylorwork/azure-arm-templates/tree/master/disk-management-selection . Example

Authenticating with Azure Active Directory on powershell

扶醉桌前 提交于 2019-11-30 14:04:30
I am attempting to explore the features of the Azure Active Directory V2 PowerShell Module I have an Azure Account, and I have set up an Active Directory with multiple users. My first goal is simple: show me the list of users. So I type: Connect-AzureAD I am presented with a dialog and type in my user account and password. It returns on object of type Microsoft.Open.Azure.AD.CommonLibrary.PSAzureContext . I then type Get-AzureADUser And the error is: Get-AzureADUser : Error occurred while executing GetUsers Code: Authentication_Unauthorized Message: User was not found HttpStatusCode: Forbidden