New-AzureRmDnsZone cmdlet do not able to find resource group - azure

I created a DNS Zone and a custom resource group 'Default-DNS-Zone' from portal but on shell prompt, executing below command throws Default-DNS-Zone not found. I still was able to do it from portal again.
PS C:\HBala> New-AzureRmDnsZone -Name www.example.com -ResourceGroupName Default-DNS-Zone
New-AzureRmDnsZone : ResourceGroupNotFound: Resource group 'Default-DNS-Zone' could not be found.
At line:1 char:1
Would it be anything to do with the OS support for the cmdlet? I use Windows 7.

If you're convinced that you are using the correct resource group name and subscription (please double-check!) then the next step should be to raise a Support ticket so the issue can be assigned to an engineer for further investigation.

Related

Wrong resource Group when I create a Managed Certificate in Azure

I would like to create a free Managed Certificate for my web app.
When I create the certificate I get the error Resource under Resource group xxx not found... Despite the error, the certificate is created, but also the inexistent resource group is created. The resource group is an old group I deleted times ago.
Everythings seems to be worked correctly but I would like to have a consistent situation.
I let you see in details:
What you see in the image above is my web app that is in the resource group dev-p...l-rg-westeu.
The I go in the TLS/SSL settings page (or in the TLS/SSL settings (preview) page.. nothing change, I get same error) and I create a managed certificate.. Here it is what I get:
I get the error that the web app xxx is not found under resource group dev-m...o-rg-westeu.. That's correct!! Because the web app is under the resource group dev-p...l-rg-westeu, not under dev-m...o-rg-westeu.
However the certificate is created, but under the wrong resource group:
Then I deleted the certificate. I deleted also the wrong resource group, because I do not need it and try and try again. Always same error. I also tryed to create the certificate via powershall:
New-AzWebAppCertificate -ResourceGroupName "dev-p...l-rg-westeu" -WebAppName "xxx" -Name "xxxx" -HostName "xxxx" -SslState 'SniEnabled'
As you can see I set explicitely the resource group name. But the certificate is always created in the wrong resource group. I debugged the command. It seems a cache exists. Can I clear it? Could it be the problem?
I also deleted and created a new web app. Nothing...
Can you help me please?
Thank you
We have tested in our environment with your given PowerShell command and can able to add in our own resource group as well.
We have only one resource group in which we created an app service
Run the below command for create an App Service Managed Certificate for the given WebApp in our resource group.
New-AzWebAppCertificate -ResourceGroupName "RGNAME" -WebAppName "appname" -Name "nameofCert" -HostName "www.name.com"
After running its added succesfully to our resource group.
Please make sure that you have provided the correct resource group where your app service is created. And you have deleted the old resource group successfully .
Once the the command successfully run make a refresh of the Azure portal then goto TLS/SSL settings (preview) binding and check the certificate.
OUTPUT DETAILS FOR REFERENCE:-
Certificate added to our own resource group
For more information please refer the below links:
MICROSOFT Q&A- Azure App Service creates certificate under defunct Resource Group as suggested by #SnehaAgrawal-MSFT & This discussion as well.

Azure PowerShell: Get-AzVM does not display the output

According to this Official document example from MS Azure team, the following command should display all the VMs in my current subscription. But when I logged-in with my subscription and run the following command, it just brings me back to the command line with no output and no error. I do have VMs in this subscription, and the same login with the same subscription is working for other tasks I am performing in the same session. Question: What I may be missing here, and how can we resolve the issue?
PS C:\Users\MyUserName> Get-azVM
PS C:\Users\MyUserName>
Are you Signed into Azure Connect-AzAccount
Do you have more than one subscription?
If so you might need to switch subscriptions.
Set-AzContext -SubscriptionId "xxxx-xxxx-xxxx-xxxx"

How to check if Traffic Manager exists globally

I want to check whether a traffic manager is unique or not.
I am using Powershell Commandlets to get the information.
$profile = Get-AzureRmTrafficManagerProfile -Name $ResourceName -ResourceGroupName $ResourceGroupName
This command only checks for the traffic manager profile in the specified group. But traffic manager's are deployed globally. So, when I try to deploy with same traffic manager name in different resource group then error is thrown.
To avoid this error, I want to check at first only if that traffic manager exists globally. Didn't find any solution in documentation.
Is there any way to achieve this?
You can use the Test-AzureTrafficManagerDomainName powershell cmdlet.
C:\> get-help Test-AzureTrafficManagerDomainName
NAME
Test-AzureTrafficManagerDomainName
SYNOPSIS
Checks whether a domain name is available as a Traffic Manager profile.
SYNTAX
Test-AzureTrafficManagerDomainName [-DomainName] <String> [<CommonParameters>]
DESCRIPTION
The Test-AzureTrafficManagerDomainName cmdlet checks whether a domain name is available as a Microsoft Azure
Traffic Manager profile. If the domain name is available, this cmdlet returns a value of $True.
Or you could use a rest call to this endpoint:
https://management.core.windows.net/SUB_GUID/services/WATM/operations/isavailable/%NAME%.trafficmanager.net

How do I get the deployment id of an Azure VM?

I created a VM in Windows Azure and some networking people are asking me for the deployment id. I cannot see this property anywhere on the portal. How can I get the deployment id of a Windows Azure VM? I just created the VM through the portal.
One way is to:
Go to https://resources.azure.com and log in
Search for the name of your VM and click to open details. It should return JSON information about the VM.
In the JSON data, search for deploymentId (it should be under the hardwareProfile section in the JSON)
You can see the deployment ID in the virtual machine's Dashboard tab. Refer to the screenshot-
Here's how you can do it via Powershell:
First log in to azure:
login-AzureRmAccount
Then get a reference to the virtual machine. In my case, I have a virtual machine called malcolms-dad in the resource group breaking-bad:
$vm = (Get-AzureRmResource -ResourceGroupName breaking-bad -ResourceName malcolms-dad -ResourceType MicrosoftClassicComputer/virtualMachines)
Now you have the reference, you can query for the deployment id property:
$vm.Properties.HardwareProfile.DeploymentId
Note that we had to pass in the -ResourceType parameter into the Get-AzureRmResource query. This might seem superfluous, but if you omit the parameter the command returns an object without the Properties field.

Azure Virtual Machine Cannot Add Extensions

I have the latest version of the Azure Powershell installed (0.9.7). I have a new virtual machine that was created via the Preview Portal. It was created with the new Resource Group model.
I am trying to install a few extensions but I cannot figure out the correct Powershell commands. Most instructions say to use Get-AzureVM. This does not return my VMs. If I use Switch-AzureMode to AzureResourceManager, I can use Get-AzureVM to list my VM (v2 I assume).
It seems none of the Extension scripts are setup for Resource Manager mode. Most of the sample scripts say to use:
Get-AzureVM -ServiceName 'CLFeb19WS12R2A' -Name 'CLFeb19WS12R2A' | Set-AzureVMBGInfoExtension -Disable -ReferenceName 'BGInfo' | Update-AzureVM
I have tried all kinds of ways. The AzureVMBGInfoExtension cmdlet is not available in Resource Manager mode.
Any suggestions?
Create a VM
I created a new VM so that I could help you. I used portal.azure.com > New > Compute > Marketplace > Windows Server > Windows Server 2008 R2 SP1 and chose the Resource Manager deployment model.
Create an Active Directory User
Since we're using the Azure Resource Manager, I needed to create a new Active Directory user so that I could authenticate with Azure PowerShell. That is the only way that I could authenticate.
You can create one using the following steps.
Login to the Azure Portal, and select Active Directory.
If no directory exists, select Create your directory and provide the requested information.
Select your directory and add a new user. This new user is a work or school account.
During the creation of the user, you will be supplied with both an e-mail address for the user and a temporary password. Save this information as it is needed later.
From the Azure portal, select Settings and then select Administrators. Select Add, and add the new user as a co-administrator. This allows the work or school account to manage your Azure subscription.
Finally, log out of the Azure portal and then log back in using the new work or school account. If this is the first time logging in with this account, you will be prompted to change the password.
Make sure you see your subscriptions when you log in as the work or school account.
Oddly enough, Azure Resource Manager seems to work best (or only to work) with if we authenticate with one of those types of accounts.
Install the Most Recent Azure PowerShell Module
Since we need access to the Extension related commandlets, I installed the most recent version of Azure PowerShell. The link shows how to install it via the Web Platform Installer. Once done, you can find out whether you have the correct one by running this:
> (Get-Module azureresourcemanager).Version
Major Minor Build Revision
----- ----- ----- --------
0 9 7 -1
When we run the following, look at all the Extension related commandlets. Hooray!
> Switch-AzureMode -Name AzureResourceManager
> Get-Command *extension* -Module AzureResourceManager
Get-AzureVMAccessExtension
Get-AzureVMCustomScriptExtension
Get-AzureVMDiagnosticsExtension
Get-AzureVMDscExtension
Get-AzureVMExtension
Get-AzureVMExtensionImage
Get-AzureVMExtensionImageType
Remove-AzureVMAccessExtension
Remove-AzureVMCustomScriptExtension
Remove-AzureVMDiagnosticsExtension
Remove-AzureVMDscExtension
Remove-AzureVMExtension
Set-AzureVMAccessExtension
Set-AzureVMCustomScriptExtension
Set-AzureVMDiagnosticsExtension
Set-AzureVMDscExtension
Set-AzureVMExtension
We have access to these while being in Resource Manager mode. To learn how to use each of them, run Get-Help Set-AzureVMAccessExtension -example on each one that is of interest. Then play around with the example.
Authenticate Azure PowerShell & Set the Extensions for Your VM
When authenticating via Add-AzureAccount, use the Active Directory user that we created. Then you can query your virtual machines.
> Add-AzureAccount
> Get-AzureResource -ResourceType Microsoft.Compute/virtualMachines
Once you know the details of your VM, you can add an extensions. Here is one example that worked for me.
> Set-AzureVMAccessExtension -ResourceGroupName "mvp1" -Location "West US" -VMName "mvp1" -Name "mvp1test" -TypeHandlerVersion "2.0" -UserName "shaunluttin" -Password "Password
EndTime : 9/1/2015 9:35:57 PM -07:00
Error :
Output :
StartTime : 9/1/2015 9:35:20 PM -07:00
Status : Succeeded
TrackingOperationId : f03210e0-e67e-40d7-aad7-d9acef64bebe
RequestId : 95f42767-edcf-443a-8977-4c9f6d0eafef
StatusCode : OK
Best of luck with that. Let me know if you have any questions.

Resources