Unable to find "ServiceName" on Azure Free Trial - azure

I'm currently on an Azure free trial and trying to setup a reverse DNS PTR record.
I've logged in via certificate, downloaded the file using: Get-AzurePublishSettingsFile. I've also imported the file using Import-AzurePublishSettingsFile C:certs<SubscriptionName>-credentials.publishsettings.
However, when I run Get-AzureService | fl ServiceName I don't get any services listed.
When I try and run Set-AzureService –ServiceName "my hostname" –Description "Reverse DNS" –ReverseDnsFqdn "mail.my domain."
I get The hosted Service name does not exist.
Is there a limitation on the free trial that doesn't allow this to be set?

After Import... add
Select-AzureSubscription -SubscriptionName "nameofyoursubscription"
Just importing your subscription publish settings file does not select the subscription you need.
UPD: i was not able to reproduce the issue. Please try to execute:
$subscr = "subscriptionid"
$csname = "mytestcloudservice14"
Select-AzureSubscription -SubscriptionId $subscr –Current
New-AzureService -ServiceName $csname -Location "Central US" -Label "mytestcloudservice"
Set-AzureService –ServiceName $csname –Description "Reverse DNS" –ReverseDnsFqdn "mytestcloudservice14.cloudapp.net."
Get-AzureService -ServiceName $csname
I just created the trial account and tested it.

As the description of Get-AzureService says, it returns an object with information about the cloud services for the current subscription, which means, it's an operation on Azure cloud service only, Set-AzureService as well.
So if you didn't deploy any cloud services, Get-AzureService will definitely list nothing and if your "my hostname" is not cloud service, it's no wonder you get the error message The hosted service does not exist..
In addition, Reverse DNS is not supported for Azure Websites. Reverse DNS is supported for Azure PaaS roles and IaaS virtual machines.

Related

how to fix 'conflicts with an already existing hostname' while cloning web app using Azure cloudshell

Scenario: You want to clone an app to another region, while configuring an Azure Resource Manager traffic manager profile that includes both apps.
Below are the commands I tried
$srcapp = Get-AzWebApp -ResourceGroupName SourceAzureResourceGroup -Name
source-webapp
$destapp = New-AzWebApp -ResourceGroupName DestinationAzureResourceGroup -Name dest-webapp -Location "South Central US" -AppServicePlan DestinationAppServicePlan -SourceWebApp $srcapp -TrafficManagerProfileName newTrafficManagerProfile
the above commands fail with ""Creating app with backup from 'subscriptiondetailshere' failed: Detail: Hostname \'abc.xyz.companydomain.com\' conflicts with an already existing hostname. ExtendedCode: 04005"
FYI : the apps are hosted in standard app service plan. I did read documentation saying only the premium apps can be cloned but I was able to clone this particular app in standard plan through Azure Portal UI.
I want to be able to automate this using the ps. Any pointers are appreciated
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-app-cloning
Update:
copied web app:
Traffic manager:
First, azure web app clone does support standard app service plan. Here is a screenshot from the doc:
Second, the code you're using is correct, I did a test at my side, it's working fine(The web app is copied from central us to west us, after copied, everything is working fine):
For the conflicting error, you should check in your destination resource group if there is a existing web app with that host name(you mentioned that you can copy from azure portal, maybe you didn't delete it when you were using code to copy it).

Get Remote Desktop Status of Cloud Service(classic) using Get-AzureServiceRemoteDesktopExtension or any cmdlet

I'm new to powershell and Azure cmdlets(ASM or ARM). I'm trying to list all the cloud service along with its Remote Desktop status(Enabled or Disabled). I'm able to get the cloud service details using Get-AzureService or Get-AzureDeployment cmdlets.
To get the Remote Desktop Status, I'm using this cmdlet Get-AzureServiceRemoteDesktopExtension but it is not returning anything.
Get-AzureServiceRemoteDesktopExtension -ServiceName mycloudservicename -Slot Production
Few observation from azure portal settings:
The "Remote Desktop"(RD) blade under cloud service is having a Role
for which currently RD is disabled for both the
slots(Production/Staging). Not sure if this
Get-AzureServiceRemoteDesktopExtension cmdlet work only when the RD
is enabled.
The "Roles and Instances" blade has a Role with 2 instances, both
of which doesn't have the Connect button enabled as the RD is not
enabled.
I'm seeing "Disabled" node under Extensions blade. I'm not sure if
the extension has to be enabled or install/get any extension. I
tried something like below but that also not returning anything.
Get-AzureServiceExtension -ServiceName mycloudservicename -Slot "Production"
-ExtensionName "RDP" -ProviderNamespace "Microsoft.Windows.Azure.Extensions"
Any thoughts what i'm missing here to get Get-AzureServiceRemoteDesktopExtension working? Or let me know if any other easy way to get the RD status. Thanks!
The command Get-AzureServiceRemoteDesktopExtension works only when the RD is enabled, I can reproduce your issue on my side, just enable the RD, it will work fine.

Finding azure Availability sets using Azure in classic mode

I am trying to find the availability sets in a Azure Cloud Service using powershell. The Cloud Service was created using classic model.
I am not sure if this is the right answer:
get-AzureService -ServiceName "myService"
That is correct. Get-AzureService returns with the information about the cloud services for the current subscription.
The Syntax is:
Get-AzureService -ServiceName "nameOfService"

Antimalware for Azure Cloud Service

I understand that there is way to enable Antimalware for Azure VM like below:
But I don't see such option when creating a Cloud Service.
There is a worker role running on Azure Cloud Service. The organization has a security rule of having Antimalware on the machines.
Does a Cloud Service by default contain antimalware?
I Wish Microsoft were better at documenting their stuff. It seems that AntiMalware extension is also avialable for Cloud Services, not only Virtual Machines. But this can only be understood from the PowerShell reference here. And another resource entirely for Extensions on Cloud Services.
A valid and working PowerShell Script can be found here:
Add-AzureAccount
# use Select-AzureSubscription in case your account has more than one
Select-AzureSubscription -SubscriptionName 'PUT HERE YOUR SUBSCRIPTION'
[System.Xml.XmlDocument] $XmlConfig = New-Object System.Xml.XmlDocument
# load the Antimalware extension configuration from external XML file
# The content of the XML needs to be:
# <AntimalwareConfig><AntimalwareEnabled>true</AntimalwareEnabled></AntimalwareConfig>
# ref.: http://msdn.microsoft.com/en-US/library/azure/dn771718
$XmlConfig.load('D:\tmp\AntiMalware.config')
Set-AzureServiceAntimalwareExtension -ServiceName "PUT HERE THE CLOUD SERVICE NAME" -AntimalwareConfiguration $XmlConfig

Azure: DNS change after VM setup

I recently setup Active Directory on a VM inside an Azure Virtual Network. Unfortunately, the Virtual Network DNS entry was not put in before creating and working with the Active Directory VM.
Because of Azure's framework, I believe I have to recreate the VM (after making the DNS change). Does anyone know how to take a snapshot of the virtual hard-drive and re-associate that with a newly created VM after the DNS change is made. I have read information about sysprep to capture an image but I'm afraid that will corrupt various AD settings.
Also, does anyone have any other information about this type of DNS change?
Thanks,
akgh
Here are the steps:
First export the VM configuration to an XML file
get-azurevm -servicename [service name] | export-azurevm -path [local path]
This generates a small XML file that contains information about the VM.
Next, remove the VM configuration from Azure.
remove-azurevm [VM name]
This does not actually delete the VHD file, it only removes the configuration about the VHD that you have previously backed-up/exported from step 1. So there is no danger or destruction done here. These are actually the same steps you would do if you wanted to stop paying for the service.
Now, restore the VM configuration with the new DNS settings you want.
$dnslocal=New-AzureDNS -Name "my Azure DNS Server" -IPaddress "192.168.10.4"
$dnsonprem=New-AzureDNS -Name "my OnPrem DNS Server" -IPaddress "172.16.83.21"
Import-AzureVM -Path 'E:\myVM.xml' | New-AzureVM -ServiceName 'myVM' -Location 'West US' -DnsSettings $dnslocal,$dnsonprem -VNetName "MyVNET" –AffinityGroup “CATAFF1”
Note: You may get an error when trying to import the VM configuration. If you get an error that the DNS name already exists, then you may need to remove the cloud service
remove-azureservice –servicename “myVM"

Resources